summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2017-09-14 06:41:39 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-09-14 06:41:39 (GMT)
commit5dbb28ececdd0382d85b164aaf37bec1ae08036c (patch)
tree016dc1f6d9a9dd8a85c1adb53dd49e7c2e9604f7 /Python
parentfa82dda1012b406a7091587fc65384ce11528346 (diff)
downloadcpython-5dbb28ececdd0382d85b164aaf37bec1ae08036c.zip
cpython-5dbb28ececdd0382d85b164aaf37bec1ae08036c.tar.gz
cpython-5dbb28ececdd0382d85b164aaf37bec1ae08036c.tar.bz2
[3.6] bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__ attribute. (GH-3539) (#3556)
(cherry picked from commit f6e61df01536493f1280cd07639c7ff9bffb2cdc)
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 6095843..2f39f9d 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -978,7 +978,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;