summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorOren Milman <orenmn@gmail.com>2017-09-13 22:30:05 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-09-13 22:30:05 (GMT)
commitf6e61df01536493f1280cd07639c7ff9bffb2cdc (patch)
treed0a96b29fe228e394853da6c4246f9252a786a28 /Python
parentace1ecc00b35a8b1dc6e352d547dde07913017bb (diff)
downloadcpython-f6e61df01536493f1280cd07639c7ff9bffb2cdc.zip
cpython-f6e61df01536493f1280cd07639c7ff9bffb2cdc.tar.gz
cpython-f6e61df01536493f1280cd07639c7ff9bffb2cdc.tar.bz2
bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__ attribute. (#3539)
Diffstat (limited to 'Python')
-rw-r--r--Python/errors.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 3cb6d53..5709fdd 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -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;