Repository navigation
bpo-45324: Capture data in FrozenImporter.find_spec() to use in exec_module(). #28633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ericsnowcurrently
merged 25 commits into
python:main
from
ericsnowcurrently:frozen-modules-find-spec
Oct 5, 2021
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
97bdaa2
Make use of find_frozen() more consistent.
ericsnowcurrently e2e676d
Drop some one-off helper functions.
ericsnowcurrently 6333212
Factor out unmarshal_frozen_code().
ericsnowcurrently 8cd239b
Add a "data" arg to _imp.get_frozen_object().
ericsnowcurrently 7724019
Add _imp.find_frozen().
ericsnowcurrently 0dd3870
Use _imp.find_frozen() in the frozen importer.
ericsnowcurrently 1a0ad16
Clear loader_state to save memory.
ericsnowcurrently fdf7689
Only call is_frozen() in the fallback case.
ericsnowcurrently 385d412
Add a NEWS entry.
ericsnowcurrently e0fe501
Add a missing "static" declaration.
ericsnowcurrently 7221e0e
Treat FROZEN_BAD_NAME as FROZEN_NOT_FOUND in some cases.
ericsnowcurrently 5f68ee8
Make frozen_info.size Py_ssize_t.
ericsnowcurrently 7b85a63
Py_ssize_t is never smaller than int.
ericsnowcurrently cdbc611
name -> nameobj.
ericsnowcurrently c6e70cc
Add tests.
ericsnowcurrently f86dcd5
Tweak the tests.
ericsnowcurrently d1b1868
Default to using _imp.get_frozen_object().
ericsnowcurrently 4e105a9
Do not use <> to mark source package.
ericsnowcurrently 5d6af1e
Drop unused code.
ericsnowcurrently 017c932
Store data in loader_state directly.
ericsnowcurrently 1a833ed
Set "name" on import errors.
ericsnowcurrently 5363708
Use a narrower exception.
ericsnowcurrently 07c947f
Fix a comment.
ericsnowcurrently cddf089
Clarify a comment.
ericsnowcurrently ca0500f
Add a note about why we silence an error.
ericsnowcurrently File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Clarify a comment.
- Loading branch information
commit cddf0895396f8c8a1f92236691e854c94d3cedd2
There are no files selected for viewing
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
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 was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the loader is one-time use? What happens if you call exec_module() again (e.g.
importlib.reload())? Won't this break that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should work fine. If the data is set then the
_imp.get_frozen_object()call inexec_module()will unmarshal that. If the data isn't set (e.g. with a reload) thenget_frozen_object()will look up the frozen data, in addition to unmarshaling it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added to that comment to clarify.