FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.15] gh-148587: Make sys.lazy_modules match PEP and keep internal lazy submodules tra… by DinoV · Pull Request #150014 · python/cpython · GitHub

/ cpython Public

[3.15] gh-148587: Make sys.lazy_modules match PEP and keep internal lazy submodules tra… - #150014

Merged
DinoV merged 3 commits into
python:3.15from
DinoV:lazy_modules
May 19, 2026
Merged

[3.15] gh-148587: Make sys.lazy_modules match PEP and keep internal lazy submodules tra…#150014
DinoV merged 3 commits into
python:3.15from
DinoV:lazy_modules

Conversation

DinoV commented May 18, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

The PEP initially set sys.lazy_modules was to be a set of the lazily imported things. At some point it seemed that having our internal tracking for publishing submodules to parent modules when they're imported could be combined with this. But this means that data the interpreter is making decisions on is now immutable. This goes back to having a separate set for the lazy modules which is user visible but has no impact on how lazy imports are evaluated or executed.

This is one possible approach - another one would be to make it a function and calculate the set and return it per-call. Then it would be backed by our normal internal data.

We could also make it a function and keep tracking both sets of data as this PR does and then that'd give us the ability in the future to lazily calculate the data.

DinoV changed the title Make sys.lazy_modules match PEP and keep internal lazy submodules tra… gh-148587: Make sys.lazy_modules match PEP and keep internal lazy submodules tra… May 18, 2026
DinoV changed the title gh-148587: Make sys.lazy_modules match PEP and keep internal lazy submodules tra… [3.15] gh-148587: Make sys.lazy_modules match PEP and keep internal lazy submodules tra… May 18, 2026

Yhg1s left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think this approach makes sense...

DinoV merged commit 94c8bac into python:3.15 May 19, 2026
54 checks passed

hugovk commented May 19, 2026

Copy link
Copy Markdown
Member

This went directly into 3.15, does it need forward porting to main?

johnslavik commented May 19, 2026
edited
Loading

Copy link
Copy Markdown
Member

This went directly into 3.15, does it need forward porting to main?

Correct, thank you for catching that.

Great work @DinoV! This was the cleanest idea.
cc @pablogsal

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL