summaryrefslogtreecommitdiffstats
path: root/Python/importdl.c
diff options
context:
space:
mode:
authorOren Milman <orenmn@gmail.com>2017-09-19 11:39:47 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-09-19 11:39:47 (GMT)
commit9974e1bcf3d0cec9b38b39b39b7ec8a1ebd9ef54 (patch)
tree5cd22abadd721260709dcd9e43ab6a173107f1e0 /Python/importdl.c
parent6db7033192cd537ca987a65971acb01206c3ba82 (diff)
downloadcpython-9974e1bcf3d0cec9b38b39b39b7ec8a1ebd9ef54.zip
cpython-9974e1bcf3d0cec9b38b39b39b7ec8a1ebd9ef54.tar.gz
cpython-9974e1bcf3d0cec9b38b39b39b7ec8a1ebd9ef54.tar.bz2
bpo-31315: Fix an assertion failure in imp.create_dynamic(), when spec.name is not a string. (#3257)
Diffstat (limited to 'Python/importdl.c')
-rw-r--r--Python/importdl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/importdl.c b/Python/importdl.c
index 32fb7e1..50231ff 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -103,6 +103,11 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp)
if (name_unicode == NULL) {
return NULL;
}
+ if (!PyUnicode_Check(name_unicode)) {
+ PyErr_SetString(PyExc_TypeError,
+ "spec.name must be a string");
+ goto error;
+ }
name = get_encoded_name(name_unicode, &hook_prefix);
if (name == NULL) {