gh-132775: Add _PyPickle_GetXIData()#133107
Merged
ericsnowcurrently merged 6 commits intopython:mainfrom Apr 30, 2025
Merged
Conversation
|
🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 15ecef1 🤖 Results will be shown at: If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again. |
iritkatriel
reviewed
Apr 30, 2025
| @contextlib.contextmanager | ||
| def module_restored(name): | ||
| """A context manager that restores a module to the original state.""" | ||
| missing = name in sys.modules |
Member
There was a problem hiding this comment.
shouldn't missing be name not in sys.modules? (or renamed to present)?
also, is it different than orig is not None?
Member
Author
There was a problem hiding this comment.
Yeah, it should be "not" in sys.modules. Good catch.
It is different from orig is not None since None could be set in sys.modules. I could use a temporary sentinel for that, I suppose.
ericsnowcurrently
added a commit
that referenced
this pull request
May 5, 2025
…gh-133472) This is a follow-up to gh-133107. I realized that we could end up with an infinite recursion if we try to run a function from __main__ in a subinterpreter.
neonene
reviewed
May 6, 2025
| if sys.modules.get(name) is not None: | ||
| mod = sys.modules[name] | ||
| else: | ||
| mod, _, _ = _force_import(name, False, True, clearnone) |
Contributor
There was a problem hiding this comment.
_force_import() is not defined. Perhaps, _ensure_module() here?
Pranjal095
pushed a commit
to Pranjal095/cpython
that referenced
this pull request
Jul 12, 2025
…Data() (pythongh-133472) This is a follow-up to pythongh-133107. I realized that we could end up with an infinite recursion if we try to run a function from __main__ in a subinterpreter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There's some extra complexity due to making sure we we get things right when handling functions and classes defined in the
__main__module. This is also reflected in the tests, including the addition of extra functions in test.support.import_helper.