Print exception information in debug/linux

This commit is contained in:
Oleksii Shevchuk 2017-04-25 11:08:01 +03:00
parent 3686a59f18
commit 2b3df567f4
2 changed files with 6 additions and 2 deletions

View File

@ -30,6 +30,7 @@ PyObject *, Py_BuildValue, (char *, ...)
PyObject *, PyObject_Call, (PyObject *, PyObject *, PyObject *)
void, PySys_WriteStderr, (const char *, ...)
PyObject *, PyErr_Occurred, (void)
void, PyErr_Fetch, (PyObject **, PyObject **, PyObject **)
void, PyErr_Clear, (void)
int, PyObject_IsInstance, (PyObject *, PyObject *)

View File

@ -161,8 +161,11 @@ uint32_t mainThread(int argc, char *argv[], bool so) {
if (seq) {
PyObject *discard = PyEval_EvalCode((PyCodeObject *)sub, d, d);
if (!discard) {
dprint("discard\n");
PyErr_Print();
#ifdef DEBUG
PyObject *ptype, *pvalue, *ptraceback;
PyErr_Fetch(&ptype, &pvalue, &ptraceback);
dprint("SEQ %d EXCEPTION: %s\n", i, PyString_AsString(pvalue));
#endif
rc = 255;
}
Py_XDECREF(discard);