[3.14] gh-133485: Use interpreters.Interpreter in InterpreterPoolExecutor (gh-135695)

Most importantly, this resolves the issues with functions and types defined in __main__.
It also expands the number of supported objects and simplifies the implementation.

(cherry picked from commit 725da50520, AKA gh-133957)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-06-19 02:23:12 +02:00 committed by GitHub
parent c03f94e7fe
commit bc8ed42176
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 266 additions and 205 deletions

View file

@ -674,7 +674,9 @@ _PyPickle_Loads(struct _unpickle_context *ctx, PyObject *pickled)
finally:
if (exc != NULL) {
sync_module_capture_exc(tstate, &ctx->main);
if (_PyErr_Occurred(tstate)) {
sync_module_capture_exc(tstate, &ctx->main);
}
// We restore the original exception.
// It might make sense to chain it (__context__).
_PyErr_SetRaisedException(tstate, exc);