Base: Improve Python exception handling
If the Python profiler is activated then transporting the dict as exception object is broken where InteractiveInterpreter::runCode() fails to restore it. To fix the problem use Exception::setPyException() instead inside the macto PY_CATCH and the generated wrapper code. This also improves exception handling in command line mode.
This commit is contained in:
@@ -446,12 +446,10 @@ BaseExport extern PyObject* PyExc_FC_AbortIOException;
|
||||
#define PY_TRY try
|
||||
|
||||
#define __PY_CATCH(R) \
|
||||
catch(Base::Exception &e) \
|
||||
catch(const Base::Exception &e) \
|
||||
{ \
|
||||
auto pye = e.getPyExceptionType(); \
|
||||
if(!pye) \
|
||||
pye = Base::PyExc_FC_GeneralError; \
|
||||
_Py_ErrorObj(R,pye,e.getPyObject()); \
|
||||
e.setPyException(); \
|
||||
R; \
|
||||
} \
|
||||
catch(const std::exception &e) \
|
||||
{ \
|
||||
|
||||
Reference in New Issue
Block a user