Skip to content

Add advice how to freeze fewer modules #101298

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
merged 2 commits into from
Jan 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Tools/build/freeze_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
OS_PATH = 'ntpath' if os.name == 'nt' else 'posixpath'

# These are modules that get frozen.
# If you're debugging new bytecode instructions,
# you can delete all sections except 'import system'.
# This also speeds up building somewhat.
TESTS_SECTION = 'Test module'
FROZEN = [
# See parse_frozen_spec() for the format.
Expand All @@ -45,6 +48,7 @@
# on a builtin zip file instead of a filesystem.
'zipimport',
]),
# (You can delete entries from here down to the end of the list.)
('stdlib - startup, without site (python -S)', [
'abc',
'codecs',
Expand Down Expand Up @@ -80,6 +84,7 @@
'<__phello__.**.*>',
f'frozen_only : __hello_only__ = {FROZEN_ONLY}',
]),
# (End of stuff you could delete.)
]
BOOTSTRAP = {
'importlib._bootstrap',
Expand Down Expand Up @@ -520,7 +525,7 @@ def regen_frozen(modules, frozen_modules: bool):

for lines in (bootstraplines, stdliblines, testlines):
# TODO: Is this necessary any more?
if not lines[0]:
if lines and not lines[0]:
del lines[0]
for i, line in enumerate(lines):
if line:
Expand Down