aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2020-12-03 13:38:58 +0100
committerChristian Tismer <tismer@stackless.com>2020-12-03 14:33:22 +0100
commitc6184e01e993dcca9798f306fb8e9cb322fdd0dc (patch)
treeb44a4e06a39e1d6a57a0767215defeaa60afa474 /sources/shiboken2/generator/shiboken2/cppgenerator.cpp
parent64757c6cc2eeece0974f99ac6e75a46e5f6ab693 (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> (cherry picked from commit 288fadb796ec4e11e99e3752d531ada7edf15d75)
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/cppgenerator.cpp')
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index ff44db955..87ddd73a5 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -5230,6 +5230,8 @@ void CppGenerator::writeFlagsBinaryOperator(QTextStream &s, const AbstractMetaEn
s << INDENT << "cppArg = static_cast<" << flagsEntry->originalName()
<< ">(int(PyInt_AsLong(" << PYTHON_ARG << ")));\n";
s << "#endif\n\n";
+ s << INDENT << "if (PyErr_Occurred())\n" << indent(INDENT)
+ << INDENT << "return nullptr;\n" << outdent(INDENT);
s << INDENT << "cppResult = " << CPP_SELF_VAR << " " << cppOpName << " cppArg;\n";
s << INDENT << "return ";
writeToPythonConversion(s, flagsType, nullptr, QLatin1String("cppResult"));