bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__ attribute. (#3539)
This commit is contained in:
committed by
Serhiy Storchaka
parent
ace1ecc00b
commit
f6e61df015
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user