Fix Python exception handling
This commit is contained in:
parent
a882476c25
commit
a5d9d6312d
|
@ -71,12 +71,16 @@ PyException::PyException(void)
|
|||
|
||||
|
||||
_stackTrace = PP_last_error_trace; /* exception traceback text */
|
||||
|
||||
// This should be done in the constructor because when doing
|
||||
// in the destructor it's not always clear when it is called
|
||||
// and thus may clear a Python exception when it should not.
|
||||
PyGILStateLocker locker;
|
||||
PyErr_Clear(); // must be called to keep Python interpreter in a valid state (Werner)
|
||||
}
|
||||
|
||||
PyException::~PyException() throw()
|
||||
{
|
||||
PyGILStateLocker locker;
|
||||
PyErr_Clear(); // must be called to keep Python interpreter in a valid state (Werner)
|
||||
}
|
||||
|
||||
void PyException::ReportException (void) const
|
||||
|
|
|
@ -60,7 +60,7 @@ void AppCompleteExport initComplete()
|
|||
try {
|
||||
Base::Interpreter().loadModule("Draft");
|
||||
}
|
||||
catch (const Base::PyException& e) {
|
||||
catch (const Base::Exception& e) {
|
||||
// If called from console then issue a message but don't stop with an error
|
||||
PySys_WriteStdout("Import error: %s\n", e.what());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user