Skip to content
Snippets Groups Projects
Commit ab159c62 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Bug while retrieving Python stack trace from C++.

parent 676a9948
No related branches found
No related tags found
No related merge requests found
......@@ -167,14 +167,13 @@ std::string PyEmbeddedUtils::pythonStackTrace()
result << "\n";
PyObject* pyth_func = PyObject_GetAttrString(pyth_module, "format_exception");
if (pyth_func && PyCallable_Check(pyth_func)) {
PyObject* pyth_val;
pyth_val = PyObject_CallFunctionObjArgs(pyth_func, ptype, pvalue, ptraceback, NULL);
pystr = PyObject_Str(pyth_val);
if (char* str = PyString_AsString(pystr))
result << std::string(str);
Py_DECREF(pyth_val);
PyObject* pyth_val = PyObject_CallFunctionObjArgs(pyth_func, ptype, pvalue, ptraceback, NULL);
if (pyth_val) {
pystr = PyObject_Str(pyth_val);
if (char* str = PyString_AsString(pystr))
result << std::string(str);
Py_DECREF(pyth_val);
}
}
result << "\n";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment