mirror of
https://github.com/python/cpython.git
synced 2026-06-28 11:50:50 +00:00
gh-151510: Fix __lazy_import__ without frame (#151511)
This commit is contained in:
parent
16185e9fe2
commit
eff805b7a7
4 changed files with 41 additions and 0 deletions
|
|
@ -313,6 +313,12 @@ builtin___lazy_import___impl(PyObject *module, PyObject *name,
|
|||
PyThreadState *tstate = PyThreadState_GET();
|
||||
if (globals == NULL) {
|
||||
globals = PyEval_GetGlobals();
|
||||
if (globals == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"__lazy_import__() missing globals "
|
||||
"when called without a frame");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (locals == NULL) {
|
||||
locals = globals;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue