mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
bpo-31315: Fix an assertion failure in imp.create_dynamic(), when spec.name is not a string. (#3257)
This commit is contained in:
parent
6db7033192
commit
9974e1bcf3
3 changed files with 18 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue