mirror of
https://github.com/python/cpython.git
synced 2026-02-22 15:10:47 +00:00
gh-145076: Check globals type in __lazy_import__() (#145086)
This commit is contained in:
parent
fbd3b25e00
commit
2be2dd5fc2
2 changed files with 8 additions and 0 deletions
|
|
@ -318,6 +318,12 @@ builtin___lazy_import___impl(PyObject *module, PyObject *name,
|
|||
locals = globals;
|
||||
}
|
||||
|
||||
if (!PyDict_Check(globals)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"expect dict for globals, got %T", globals);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (PyDict_GetItemRef(globals, &_Py_ID(__builtins__), &builtins) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue