Skip to content

GH-151672: __lazy_import__ always resolves to the module being imported#151827

Merged
pablogsal merged 2 commits into
python:mainfrom
brandtbucher:codex/fix-lazy-import-fromlist
Jun 28, 2026
Merged

GH-151672: __lazy_import__ always resolves to the module being imported#151827
pablogsal merged 2 commits into
python:mainfrom
brandtbucher:codex/fix-lazy-import-fromlist

Conversation

@brandtbucher

@brandtbucher brandtbucher commented Jun 21, 2026

Copy link
Copy Markdown
Member

Fix an inconsistency where calling __lazy_import__ with a string fromlist would resolve to the named member, rather than the module being imported (which is what other fromlist types and __import__ all do).

@brandtbucher brandtbucher added type-bug An unexpected behavior, bug, or error interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-lazy-imports needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 21, 2026
@brettcannon brettcannon removed their request for review June 22, 2026 19:28

@pablogsal pablogsal 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.

LGTM!

@pablogsal pablogsal merged commit 2d0003c into python:main Jun 28, 2026
68 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @brandtbucher for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jun 28, 2026

Copy link
Copy Markdown

GH-152534 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 28, 2026
pablogsal pushed a commit that referenced this pull request Jun 29, 2026
…ng imported (GH-151827) (#152534)

GH-151672: `__lazy_import__` always resolves to the module being imported (GH-151827)
(cherry picked from commit 2d0003c)

Co-authored-by: Brandt Bucher <brandt@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-lazy-imports type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants