summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorOren Milman <orenmn@gmail.com>2017-09-19 11:23:01 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-09-19 11:23:01 (GMT)
commit6db7033192cd537ca987a65971acb01206c3ba82 (patch)
treef05068e6e7e700e321cd282f577570918d9c64f6 /Python
parent453408a50508bb6801b6724ba7c7d1c017c218b6 (diff)
downloadcpython-6db7033192cd537ca987a65971acb01206c3ba82.zip
cpython-6db7033192cd537ca987a65971acb01206c3ba82.tar.gz
cpython-6db7033192cd537ca987a65971acb01206c3ba82.tar.bz2
bpo-31492: Fix assertion failures in case of a module with a bad __name__ attribute. (#3620)
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 8cc5094..cf0c6c9 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);