summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generators/boostpython/cppgenerator.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/generators/boostpython/cppgenerator.cpp b/generators/boostpython/cppgenerator.cpp
index 648bf9d..e3c3b75 100644
--- a/generators/boostpython/cppgenerator.cpp
+++ b/generators/boostpython/cppgenerator.cpp
@@ -681,7 +681,7 @@ void CppGenerator::writeVirtualMethodImplHead(QTextStream& s, const AbstractMeta
{
Indentation indentation(INDENT);
- s << INDENT;
+ s << INDENT << "try {" << endl << INDENT << INDENT;
if (func->type())
s << "python::object __result = ";
@@ -717,6 +717,13 @@ void CppGenerator::writeVirtualMethodImplHead(QTextStream& s, const AbstractMeta
s << INDENT << "return __return_value;" << endl;
}
}
+
+ s << INDENT << "} catch (boost::python::error_already_set) {" << endl;
+ s << INDENT << INDENT << "PyErr_Print();" << endl;
+ s << INDENT << INDENT << "throw boost::python::error_already_set();" << endl;
+ s << INDENT << "}" << endl;
+
+
}
s << INDENT << "}" << endl;
}