summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-10-05 10:45:25 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2010-10-05 13:57:34 -0300
commit4133eda85a6cf5b7e4e1f17c36724cda1d8c42f9 (patch)
tree0a9632e4be5f98062a594ad0f4e1c947634d6d8e
parent6c7e12d9651c1017d64a104b97a7a49631fc0a82 (diff)
downloadshiboken-4133eda85a6cf5b7e4e1f17c36724cda1d8c42f9.tar.gz
shiboken-4133eda85a6cf5b7e4e1f17c36724cda1d8c42f9.tar.xz
shiboken-4133eda85a6cf5b7e4e1f17c36724cda1d8c42f9.zip
Fix bug#402 - "Exceptions raised in event methods aren't printed to console until termination"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Renato Ara├║jo <renato.filho@openbossa.org>
-rw-r--r--generator/cppgenerator.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index 3e4f8565..dd64dc0a 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -618,21 +618,23 @@ void CppGenerator::writeVirtualMethodNative(QTextStream &s, const AbstractMetaFu
if (!injectedCodeCallsPythonOverride(func)) {
s << INDENT;
s << "Shiboken::AutoDecRef " PYTHON_RETURN_VAR "(PyObject_Call(py_override, pyargs, NULL));" << endl;
+
+ s << INDENT << "// An error happened in python code!" << endl;
+ s << INDENT << "if (" PYTHON_RETURN_VAR ".isNull()) {" << endl;
+ {
+ Indentation indent(INDENT);
+ s << INDENT << "PyErr_Print();" << endl;
+ s << INDENT << "return ";
+ if (type)
+ writeMinimalConstructorCallArguments(s, func->type());
+ s << ';' << endl;
+ }
+ s << INDENT << '}' << endl;
+
if (type) {
if (invalidateReturn)
s << INDENT << "bool invalidadeArg0 = " PYTHON_RETURN_VAR "->ob_refcnt == 1;" << endl;
- s << INDENT << "// An error happened in python code!" << endl;
- s << INDENT << "if (" PYTHON_RETURN_VAR ".isNull()) {" << endl;
- {
- Indentation indent(INDENT);
- s << INDENT << "PyErr_Print();" << endl;
- s << INDENT << "return ";
- writeMinimalConstructorCallArguments(s, func->type());
- s << ';' << endl;
- }
- s << INDENT << '}' << endl;
-
if (func->type()) {
s << INDENT << "// Check return type" << endl;
s << INDENT << "bool typeIsValid = ";