GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-45020: Freeze os, site, and codecs. by ericsnowcurrently · Pull Request #28398 · python/cpython

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented Sep 16, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

After this, the only modules left that are imported during startup are "encodings.*". We'll tackle that after we make the build output (stdout) less noisy.

https://bugs.python.org/issue45020

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ericsnowcurrently ericsnowcurrently added the skip news label Sep 16, 2021
@ericsnowcurrently
ericsnowcurrently requested a review from a team as a code owner September 16, 2021 22:23
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Sep 16, 2021
@bedevere-bot bedevere-bot added the awaiting core review label Sep 16, 2021
@ericsnowcurrently ericsnowcurrently mentioned this pull request Sep 16, 2021
Freeze/link all stdlib modules imported during startup. faster-cpython/ideas#82
Closed
23 of 46 tasks
gvanrossum
gvanrossum reviewed Sep 16, 2021
View reviewed changes

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

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.

Can you leave the encodings package for another time? I find the noise caused by the generation of the 120+ files there very distracting: even though they are not in the repo, the Make output still adds 360+ lines each time a dependency of _freeze_module changes, which is pretty much any C or .h file in the project.

It would be nice if we could freeze submodules of a package (and maybe even its __init__.py file) without freezing the entire package. Perhaps we can think of ways to tweak import.c so that importing "foo.bar" first looks for a frozen foo.bar before looking in foo.__path_rozen_?

PS. The default is still "off" right? I only get frozen modules with -X frozen_modules.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ericsnowcurrently

ericsnowcurrently commented Sep 17, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Can you leave the encodings package for another time?

Fine with me. I'm going to run the buildbots on the PR first though.

I find the noise caused by the generation of the 120+ files there very distracting: even though they are not in the repo, the Make output still adds 360+ lines each time a dependency of _freeze_module changes, which is pretty much any C or .h file in the project.

This seems like something we could fix.

It would be nice if we could freeze submodules of a package (and maybe even its __init__.py file) without freezing the entire package. Perhaps we can think of ways to tweak import.c so that importing "foo.bar" first looks for a frozen foo.bar before looking in foo.__path_rozen_?

I have a different branch that does the right thing for __path__. I just haven't bothered with it yet.

PS. The default is still "off" right? I only get frozen modules with -X frozen_modules.

Right.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ericsnowcurrently ericsnowcurrently added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Sep 17, 2021
@bedevere-bot

bedevere-bot commented Sep 17, 2021

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 74e292182cfcc8b3413745ddbc543d7a2413b418 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Sep 17, 2021
@ericsnowcurrently

ericsnowcurrently commented Sep 17, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

FYI, I'm working on fixing the "altered the execution environment" (test_socket) failures I'm seeing on the refleak buildbots.

[UPDATE] Ah, looks like it wasn't me: https://bugs.python.org/issue45187#msg402074

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ericsnowcurrently added 4 commits September 17, 2021 12:55
@ericsnowcurrently
Freeze the remaining stdlib modules imported during startup.
3df914d
@ericsnowcurrently
For now, do not freeze encodings.*.
75b1918
@ericsnowcurrently
Use separate sections for the different frozen stdlib modules.
560db53
@ericsnowcurrently
Do not use __file__ of frozen modules.
80777a9
@ericsnowcurrently
ericsnowcurrently force-pushed the frozen-startup-modules-remainder branch from d7f2b64 to 80777a9 Compare September 17, 2021 18:56
ericsnowcurrently added 2 commits September 17, 2021 13:02
@ericsnowcurrently
Regen the make file.
9c620de
@ericsnowcurrently
Fix Windows.
ffef468
@ericsnowcurrently ericsnowcurrently changed the title bpo-45020: Freeze the remaining stdlib modules imported during startup. bpo-45020: Freeze os, site, and codecs. Sep 17, 2021
@ericsnowcurrently
ericsnowcurrently merged commit 0905916 into python:main Sep 17, 2021
@bedevere-bot bedevere-bot removed the awaiting core review label Sep 17, 2021
@ericsnowcurrently
ericsnowcurrently deleted the frozen-startup-modules-remainder branch September 17, 2021 22:31
niyas-sait pushed a commit to niyas-sait/cpython that referenced this pull request Sep 21, 2021
@ericsnowcurrently @niyas-sait
bpo-45020: Freeze os, site, and codecs. (pythongh-28398)
5544d84
https://bugs.python.org/issue45020
@pelson pelson mentioned this pull request Jan 23, 2025
site.py is no longer read at startup time (as it is a deep-frozen module) #107344
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gvanrossum gvanrossum gvanrossum left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@ericsnowcurrently @bedevere-bot @gvanrossum @the-knights-who-say-ni
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.