From 6db7033192cd537ca987a65971acb01206c3ba82 Mon Sep 17 00:00:00 2001 From: Oren Milman Date: Tue, 19 Sep 2017 14:23:01 +0300 Subject: bpo-31492: Fix assertion failures in case of a module with a bad __name__ attribute. (#3620) --- Python/ceval.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Python/ceval.c') diff --git a/Python/ceval.c b/Python/ceval.c index 8cc5094a3f..cf0c6c9ae2 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4930,6 +4930,10 @@ import_from(PyObject *v, PyObject *name) if (pkgname == NULL) { goto error; } + if (!PyUnicode_Check(pkgname)) { + Py_CLEAR(pkgname); + goto error; + } fullmodname = PyUnicode_FromFormat("%U.%U", pkgname, name); if (fullmodname == NULL) { Py_DECREF(pkgname); -- cgit v1.2.1