diff options
author | Renato Filho <renato.filho@openbossa.org> | 2010-02-11 12:58:21 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-02-11 14:35:18 -0300 |
commit | 2378dd2f4b79299c78e6dfaba567830c1cc5fd4a (patch) | |
tree | 859cc665a4cb1b9845f112a51652419eadde1858 /cppgenerator.cpp | |
parent | 973de3370cc5c97531faf5cf57f5cb58d951bda0 (diff) |
Fixed error handling on Python object constructor.
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'cppgenerator.cpp')
-rw-r--r-- | cppgenerator.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp index 5f85149a4..a41a9107d 100644 --- a/cppgenerator.cpp +++ b/cppgenerator.cpp @@ -685,19 +685,20 @@ void CppGenerator::writeConstructorWrapper(QTextStream& s, const AbstractMetaFun } writeOverloadedMethodDecisor(s, &overloadData); + s << endl; if (overloadData.maxArgs() > 0) { - s << endl; - s << INDENT << "if (!cptr || PyErr_Occurred()) {" << endl; + s << INDENT << "if (PyErr_Occurred()) {" << endl; { Indentation indent(INDENT); s << INDENT << "delete cptr;" << endl; s << INDENT << "return " << m_currentErrorCode << ';' << endl; } s << INDENT << '}' << endl; + s << INDENT << "if (!cptr) goto " << cpythonFunctionName(rfunc) << "_TypeError;" << endl; + s << endl; } - s << endl; s << INDENT << "sbkSelf->cptr = cptr;" << endl; s << INDENT << "sbkSelf->validCppObject = 1;" << endl; // If the created C++ object has a C++ wrapper the ownership is assigned to Python |