mirror of
https://github.com/python/cpython.git
synced 2025-10-05 06:31:48 +00:00
[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 9974e1bcf3
)
This commit is contained in:
parent
113bc6f57b
commit
99a51d4e5b
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