diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2021-10-05 16:01:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-05 16:01:27 (GMT) |
commit | c3d9ac8b340fcbf54cee865737e67f11fcd70ed3 (patch) | |
tree | 71171709f9a44e02cca8ffee4a0fe2c49335b59a /Misc | |
parent | b9bb74871b27d9226df2dd3fce9d42bda8b43c2b (diff) | |
download | cpython-c3d9ac8b340fcbf54cee865737e67f11fcd70ed3.zip cpython-c3d9ac8b340fcbf54cee865737e67f11fcd70ed3.tar.gz cpython-c3d9ac8b340fcbf54cee865737e67f11fcd70ed3.tar.bz2 |
bpo-45324: Capture data in FrozenImporter.find_spec() to use in exec_module(). (gh-28633)
Before this change we end up duplicating effort and throwing away data in FrozenImporter.find_spec(). Now we do the work once in find_spec() and the only thing we do in FrozenImporter.exec_module() is turn the raw frozen data into a code object and then exec it.
We've added _imp.find_frozen(), add an arg to _imp.get_frozen_object(), and updated FrozenImporter. We've also moved some code around to reduce duplication, get a little more consistency in outcomes, and be more efficient.
Note that this change is mostly necessary if we want to set __file__ on frozen stdlib modules. (See https://bugs.python.org/issue21736.)
https://bugs.python.org/issue45324
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2021-09-29-12-02-39.bpo-45324.BTQElX.rst | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-09-29-12-02-39.bpo-45324.BTQElX.rst b/Misc/NEWS.d/next/Core and Builtins/2021-09-29-12-02-39.bpo-45324.BTQElX.rst new file mode 100644 index 0000000..7b16847 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2021-09-29-12-02-39.bpo-45324.BTQElX.rst @@ -0,0 +1,3 @@ +In FrozenImporter.find_spec(), we now preserve the information needed in +exec_module() to load the module. This change mostly impacts internal +details, rather than changing the importer's behavior. |