mirror of
https://github.com/python/cpython.git
synced 2026-06-23 03:23:38 -04:00
gh-151510: Fix __lazy_import__ without frame (#151511)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user