Improve reporting of Python exceptions

This commit is contained in:
wmayer
2013-05-04 14:23:53 +02:00
parent eafd67e74d
commit 3a591b3a94
12 changed files with 58 additions and 56 deletions

View File

@@ -71,9 +71,18 @@ PyException::PyException(void)
_stackTrace = PP_last_error_trace; /* exception traceback text */
}
PyException::~PyException() throw()
{
PyGILStateLocker locker;
PyErr_Clear(); // must be called to keep Python interpreter in a valid state (Werner)
}
void PyException::ReportException (void) const
{
Base::Console().Error("%s%s: %s\n",
_stackTrace.c_str(), _errorType.c_str(), what());
}
// ---------------------------------------------------------