]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-132775: Fix Interpreter.call() __main__ Visibility (gh-135638)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 17 Jun 2025 20:24:08 +0000 (22:24 +0200)
committerGitHub <noreply@github.com>
Tue, 17 Jun 2025 20:24:08 +0000 (20:24 +0000)
commit2c29ee835a28484e47f67b360dc7bd1e0aee1ec7
tree5cee8e72171ead39991cd14e6684af073a0bf5f9
parent8ec4186b257aeff0ecf200e67ce6f47bb0db9256
[3.14] gh-132775: Fix Interpreter.call() __main__ Visibility (gh-135638)

As noted in the new tests, there are a few situations we must carefully accommodate
for functions that get pickled during interp.call().  We do so by running the script
from the main interpreter's __main__ module in a hidden module in the other
interpreter.  That hidden module is used as the function __globals__.

(cherry picked from commit 269e19e0a7, AKA gh-135595)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Lib/test/test_interpreters/test_api.py
Modules/_interpretersmodule.c
Python/crossinterp.c
Python/pystate.c