mirror of
https://github.com/python/cpython.git
synced 2025-08-25 03:04:55 +00:00
gh-98354: Add unicode check for 'name' attribute in _imp_create_builtin (GH-98412)
Fixes #98354
This commit is contained in:
parent
a8fe4bbd6b
commit
1f369ad07f
3 changed files with 43 additions and 0 deletions
|
@ -1021,6 +1021,14 @@ _imp_create_builtin(PyObject *module, PyObject *spec)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!PyUnicode_Check(name)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"name must be string, not %.200s",
|
||||
Py_TYPE(name)->tp_name);
|
||||
Py_DECREF(name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PyObject *mod = create_builtin(tstate, name, spec);
|
||||
Py_DECREF(name);
|
||||
return mod;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue