mirror of
https://github.com/python/cpython.git
synced 2026-08-09 18:50:37 -04:00
bpo-31315: Fix an assertion failure in imp.create_dynamic(), when spec.name is not a string. (#3257)
This commit is contained in:
committed by
Serhiy Storchaka
parent
6db7033192
commit
9974e1bcf3
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user