Skip to content

Commit f406e17

Browse files
author
Pablo Galindo Salgado
committed
fixup! fixup! Add entry for removed API
1 parent 7acd27a commit f406e17

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Python/ceval.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3085,9 +3085,13 @@ _PyEval_LazyImportName(PyThreadState *tstate, PyObject *builtins,
30853085

30863086
if (!lazy) {
30873087
// See if __lazy_modules__ forces this to be lazy.
3088-
lazy = check_lazy_import_compatibility(tstate, globals, name, level);
3089-
if (lazy < 0) {
3090-
return NULL;
3088+
// __lazy_modules__ only applies at module level; exec() inside
3089+
// functions or classes should remain eager.
3090+
if (is_lazy_import_module_level()) {
3091+
lazy = check_lazy_import_compatibility(tstate, globals, name, level);
3092+
if (lazy < 0) {
3093+
return NULL;
3094+
}
30913095
}
30923096
}
30933097

0 commit comments

Comments
 (0)