diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2021-09-29 18:55:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-29 18:55:35 (GMT) |
commit | 45ca1c04139300ec0289a32f78c7ac922a4f7b07 (patch) | |
tree | 694e2d485fcf25be80cf8ef7314b0f52cf61c5bc /Tools/scripts | |
parent | bf5d1684a770af4e4d176bc6780874a4be168cac (diff) | |
download | cpython-45ca1c04139300ec0289a32f78c7ac922a4f7b07.zip cpython-45ca1c04139300ec0289a32f78c7ac922a4f7b07.tar.gz cpython-45ca1c04139300ec0289a32f78c7ac922a4f7b07.tar.bz2 |
bpo-45020: Do not freeze <pkg>/__init__.py twice. (gh-28635)
Currently we're freezing the __init__.py twice, duplicating the built data unnecessarily With this change we do it once. There is no change in runtime behavior.
https://bugs.python.org/issue45020
Diffstat (limited to 'Tools/scripts')
-rw-r--r-- | Tools/scripts/freeze_modules.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Tools/scripts/freeze_modules.py b/Tools/scripts/freeze_modules.py index cfc6f79..f727391 100644 --- a/Tools/scripts/freeze_modules.py +++ b/Tools/scripts/freeze_modules.py @@ -221,6 +221,7 @@ def _parse_spec(spec, knownids=None, section=None): if ispkg: pkgid = frozenid pkgname = modname + pkgfiles = {pyfile: pkgid} def iter_subs(): for frozenid, pyfile, ispkg in resolved: assert not knownids or frozenid not in knownids, (frozenid, spec) @@ -228,6 +229,12 @@ def _parse_spec(spec, knownids=None, section=None): modname = frozenid.replace(pkgid, pkgname, 1) else: modname = frozenid + if pyfile: + if pyfile in pkgfiles: + frozenid = pkgfiles[pyfile] + pyfile = None + elif ispkg: + pkgfiles[pyfile] = frozenid yield frozenid, pyfile, modname, ispkg, section submodules = iter_subs() |