aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/shiboken/cppgenerator.cpp
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2020-12-02 15:13:21 +0100
committerChristian Tismer <tismer@stackless.com>2020-12-03 10:36:20 +0000
commit288fadb796ec4e11e99e3752d531ada7edf15d75 (patch)
treea64343e629e5d53caa1369d26dddb244e58122d9 /sources/shiboken6/generator/shiboken/cppgenerator.cpp
parent7cb62fa6a72eeed2be8fbb08bdba5508da2e08fe (diff)
fix both qflags_test and the qflags cppgenerator code
There was a years-old qflags test failing on Python 3. It was blacklisted with the comment "# Nested exception in Python 3" This was nonsense: The test was wrong also for Python 2. It just happened to work, because Python 2 had some weird errors leaking. The real bug was in missing error handling in cppgenerator.cpp . See the main description in the issue. Change-Id: Ia0f9466640e0eb33f1b8b26178d33f2be0bcb32f Task-number: PYSIDE-1442 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/shiboken6/generator/shiboken/cppgenerator.cpp')
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
index 48f7915be..3ca86c3dc 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -5218,7 +5218,9 @@ void CppGenerator::writeFlagsBinaryOperator(TextStream &s, const AbstractMetaEnu
<< CPP_SELF_VAR << " = static_cast<::" << flagsEntry->originalName()
<< ">(int(PyLong_AsLong(self)));\n"
<< "cppArg = static_cast<" << flagsEntry->originalName()
- << ">(int(PyLong_AsLong(" << PYTHON_ARG << ")));\n\n"
+ << ">(int(PyLong_AsLong(" << PYTHON_ARG << ")));\n"
+ << "if (PyErr_Occurred())\n" << indent
+ << "return nullptr;\n" << outdent
<< "cppResult = " << CPP_SELF_VAR << " " << cppOpName << " cppArg;\n"
<< "return ";
writeToPythonConversion(s, flagsType, nullptr, QLatin1String("cppResult"));