Skip to content

Commit a5d2667

Browse files
committed
Fix __lazy_import__ without frame
1 parent b6a2eef commit a5d2667

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Python/bltinmodule.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,12 @@ builtin___lazy_import___impl(PyObject *module, PyObject *name,
313313
PyThreadState *tstate = PyThreadState_GET();
314314
if (globals == NULL) {
315315
globals = PyEval_GetGlobals();
316+
if (globals == NULL) {
317+
PyErr_SetString(PyExc_TypeError,
318+
"__lazy_import__() missing globals "
319+
"when called without a frame");
320+
return NULL;
321+
}
316322
}
317323
if (locals == NULL) {
318324
locals = globals;

0 commit comments

Comments
 (0)