SIGN IN SIGN UP

gh-135443: Sometimes Fall Back to __main__.__dict__ For Globals (gh-135491)

For several builtin functions, we now fall back to __main__.__dict__ for the globals
when there is no current frame and _PyInterpreterState_IsRunningMain() returns
true.  This allows those functions to be run with Interpreter.call().

The affected builtins:

* exec()
* eval()
* globals()
* locals()
* vars()
* dir()

We take a similar approach with "stateless" functions, which don't use any
global variables.
E
Eric Snow committed
a450a0ddec7a2813fb4603f0df406fa33750654a
Parent: 68b7e1a
Committed by GitHub <noreply@github.com> on 6/16/2025, 11:34:19 PM