mirror of
https://github.com/ceph/ceph
synced 2025-03-30 15:31:01 +00:00
Merge pull request #34366 from SUSE/wip-mgr-fix-python-traceback
mgr/PyModule: fix missing tracebacks in handle_pyerror() Reviewed-by: Sebastian Wagner <sebastian.wagner@suse.com> Reviewed-by: Sage Weil <sage@redhat.com> Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
commit
b8cac4f109
@ -43,6 +43,7 @@ std::string handle_pyerror()
|
||||
PyObject *exc, *val, *tb;
|
||||
object formatted_list, formatted;
|
||||
PyErr_Fetch(&exc, &val, &tb);
|
||||
PyErr_NormalizeException(&exc, &val, &tb);
|
||||
handle<> hexc(exc), hval(allow_null(val)), htb(allow_null(tb));
|
||||
object traceback(import("traceback"));
|
||||
if (!tb) {
|
||||
@ -56,6 +57,7 @@ std::string handle_pyerror()
|
||||
std::stringstream ss;
|
||||
ss << PyUnicode_AsUTF8(name_attr) << ": " << PyUnicode_AsUTF8(val);
|
||||
Py_XDECREF(name_attr);
|
||||
ss << "\nError processing exception object: " << peek_pyerror();
|
||||
return ss.str();
|
||||
}
|
||||
} else {
|
||||
@ -69,6 +71,7 @@ std::string handle_pyerror()
|
||||
std::stringstream ss;
|
||||
ss << PyUnicode_AsUTF8(name_attr) << ": " << PyUnicode_AsUTF8(val);
|
||||
Py_XDECREF(name_attr);
|
||||
ss << "\nError processing exception object: " << peek_pyerror();
|
||||
return ss.str();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user