summaryrefslogtreecommitdiff
path: root/Python/importdl.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2017-09-19 05:51:19 -0700
committerSerhiy Storchaka <storchaka@gmail.com>2017-09-19 15:51:19 +0300
commit99a51d4e5b154a7b8d971090fecc1e34769a3ca1 (patch)
tree1a612669e6b01a6c3b66ffae79c39d2dfad4dc4f /Python/importdl.c
parent113bc6f57b86aa88a5607258758718b294cf7205 (diff)
downloadcpython-git-99a51d4e5b154a7b8d971090fecc1e34769a3ca1.tar.gz
[3.6] bpo-31315: Fix an assertion failure in imp.create_dynamic(), when spec.name is not a string. (GH-3257) (#3653)
(cherry picked from commit 9974e1bcf3d0cec9b38b39b39b7ec8a1ebd9ef54)
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 f56fa94cc4..326b26fd06 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) {