[3.14] gh-132775: Fix Interpreter.call() __main__ Visibility (gh-135638)
Some checks are pending
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run

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>
This commit is contained in:
Miss Islington (bot) 2025-06-17 22:24:08 +02:00 committed by GitHub
parent 8ec4186b25
commit 2c29ee835a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 419 additions and 246 deletions

View file

@ -601,6 +601,7 @@ _make_call(struct interp_call *call,
unwrap_not_shareable(tstate, failure);
return -1;
}
assert(!_PyErr_Occurred(tstate));
// Make the call.
PyObject *resobj = PyObject_Call(func, args, kwargs);