mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
[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>
This commit is contained in:
parent
8ec4186b25
commit
2c29ee835a
4 changed files with 419 additions and 246 deletions
|
|
@ -1251,6 +1251,7 @@ _Py_CheckMainModule(PyObject *module)
|
|||
PyObject *msg = PyUnicode_FromString("invalid __main__ module");
|
||||
if (msg != NULL) {
|
||||
(void)PyErr_SetImportError(msg, &_Py_ID(__main__), NULL);
|
||||
Py_DECREF(msg);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue