31 Py_DECREF(PyImport_ImportModule(
"threading"));
81 PyThreadState_DeleteCurrent();
95 PyErr_Fetch(&type, &value, &traceback);
96 PyErr_NormalizeException(&type, &value, &traceback);
99 fcn +=
"def get_pretty_traceback(exc_type, exc_value, exc_tb):\n";
100 fcn +=
" import sys, traceback\n";
101 fcn +=
" lines = []\n";
102 fcn +=
" lines = traceback.format_exception(exc_type, exc_value, exc_tb)\n";
103 fcn +=
" output = '\\n'.join(lines)\n";
104 fcn +=
" return output\n";
106 PyRun_SimpleString(fcn.c_str());
107 PyObject*
mod = PyImport_ImportModule(
"__main__");
109 PyObject* method = PyObject_GetAttrString(mod,
"get_pretty_traceback");
111 PyObject* outStr = PyObject_CallObject(method, Py_BuildValue(
"OOO", type, value, traceback));
virtual ~PythonInterface()
GLM_FUNC_DECL genType mod(genType const &x, genType const &y)
static unsigned long mainThreadID_
std::string getTraceback()
#define UASSERT(condition)
static PyThreadState * mainThreadState_
ULogger class and convenient macros.
PyThreadState * threadState_
static unsigned long currentThreadId()