From 2b3df567f4d955ff8ae771c63f5fc8f96c7118b8 Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Tue, 25 Apr 2017 11:08:01 +0300 Subject: [PATCH] Print exception information in debug/linux --- client/sources-linux/mktab.py | 1 + client/sources-linux/pupy_load.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/sources-linux/mktab.py b/client/sources-linux/mktab.py index 8ff7f5e9..9d45da6b 100644 --- a/client/sources-linux/mktab.py +++ b/client/sources-linux/mktab.py @@ -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 *) diff --git a/client/sources-linux/pupy_load.c b/client/sources-linux/pupy_load.c index 84c43d0a..d757fc05 100644 --- a/client/sources-linux/pupy_load.c +++ b/client/sources-linux/pupy_load.c @@ -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);