gh-151510: Fix __lazy_import__ without frame (#151511)

This commit is contained in:
AN Long
2026-06-18 03:09:51 +09:00
committed by GitHub
parent 16185e9fe2
commit eff805b7a7
4 changed files with 41 additions and 0 deletions
+6
View File
@@ -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;