Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix a crash in :func:`!__lazy_import__` when called without an explicit
``globals`` argument and without a current Python frame.
6 changes: 6 additions & 0 deletions Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading