Commit 13b21bd7 authored by Victor Stinner's avatar Victor Stinner

print_exception(): handle correctly PyObject_GetAttrString() failure

Bug found by the Clang Static Analyzer.
parent a1a807b6
...@@ -1593,7 +1593,7 @@ print_exception(PyObject *f, PyObject *value) ...@@ -1593,7 +1593,7 @@ print_exception(PyObject *f, PyObject *value)
moduleName = PyObject_GetAttrString(type, "__module__"); moduleName = PyObject_GetAttrString(type, "__module__");
if (moduleName == NULL || !PyUnicode_Check(moduleName)) if (moduleName == NULL || !PyUnicode_Check(moduleName))
{ {
Py_DECREF(moduleName); Py_XDECREF(moduleName);
err = PyFile_WriteString("<unknown>", f); err = PyFile_WriteString("<unknown>", f);
} }
else { else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment