mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
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
This commit is contained in:
parent
bf5d1684a7
commit
45ca1c0413
1 changed files with 7 additions and 0 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue