diff options
author | Christian Tismer <tismer@stackless.com> | 2019-06-05 13:40:35 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2019-06-06 11:58:52 +0200 |
commit | be92136910f88c3fb6f2d1810e702fcf5e7cd25a (patch) | |
tree | 342d7ccdbb098013a3fa4ca88c5e21646b505726 /sources/pyside2 | |
parent | fd126b28e1d9b02ea16c813bc392461bdb05bd1d (diff) |
correct bool(qApp) on Python 2
The idiom to create an application if none exists
qApp or QApplication()
did not work on Python 2. This was recognized when another
unrelated test broke that tried to use the idiom.
This patch adds the missing method to Py_TYPE(Py_None)
which Python 3 already has.
A test case was added.
Side-effect.. The warning about missing braces is gone,
after the "PYTHON_IS_PYTHON3" macro is defined. This
was forgotten in the review when when the macro was
moved out of signature.cpp .
Task-number: PYSIDE-571
Change-Id: I9b9304f407cd4cafb3ba0945ffb045802503a343
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside2')
-rw-r--r-- | sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py b/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py index b38cff68b..c58aba82e 100644 --- a/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py +++ b/sources/pyside2/tests/pysidetest/qapp_like_a_macro_test.py @@ -40,7 +40,7 @@ class qAppMacroTest(unittest.TestCase): except ImportError: QtWidgets = QtGui = QtCore # qApp is in the builtins - qApp + self.assertEqual(bool(qApp), False) # and also in certain PySide modules QtCore.qApp, QtGui.qApp, QtWidgets.qApp # and they are all the same |