Commit f6e61df0 authored by Oren Milman's avatar Oren Milman Committed by Serhiy Storchaka

bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an...

bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__ attribute. (#3539)
parent ace1ecc0
Fix an assertion failure in `PyErr_WriteUnraisable()` in case of an
exception with a bad ``__module__`` attribute. Patch by Oren Milman.
......@@ -961,7 +961,7 @@ PyErr_WriteUnraisable(PyObject *obj)
}
moduleName = _PyObject_GetAttrId(t, &PyId___module__);
if (moduleName == NULL) {
if (moduleName == NULL || !PyUnicode_Check(moduleName)) {
PyErr_Clear();
if (PyFile_WriteString("<unknown>", f) < 0)
goto done;
......
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