From 5dbb28ececdd0382d85b164aaf37bec1ae08036c Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Wed, 13 Sep 2017 23:41:39 -0700 Subject: [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) --- Python/errors.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/errors.c') diff --git a/Python/errors.c b/Python/errors.c index 6095843815..2f39f9d473 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("", f) < 0) goto done; -- cgit v1.2.1