Skip to content

[3.15] gh-155194: Fix not raising on non-module import - #155188

Open
DinoV wants to merge 2 commits into
python:3.15from
DinoV:lazy_fixes
Open

[3.15] gh-155194: Fix not raising on non-module import#155188
DinoV wants to merge 2 commits into
python:3.15from
DinoV:lazy_fixes

Conversation

@DinoV

@DinoV DinoV commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

As initially reported here: https://discuss.python.org/t/sys-lazy-modules-clarification/108385

lazy import math.pi has divergent behavior from import math.pi. Currently we allow this to work and just give you the math module. Instead we should raise ModuleNotFoundError because math.pi is not a module.

@DinoV DinoV changed the title Fix not raising on non-module import gh-155194: Fix not raising on non-module import Aug 4, 2026
@DinoV DinoV added the skip news label Aug 4, 2026
@DinoV DinoV changed the title gh-155194: Fix not raising on non-module import [3.15] gh-155194: Fix not raising on non-module import Aug 4, 2026
@DinoV
DinoV requested a review from hugovk August 4, 2026 21:22
@DinoV
DinoV marked this pull request as ready for review August 4, 2026 22:49
@DinoV DinoV added 3.15 pre-release feature fixes, bugs and security fixes topic-lazy-imports labels Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.15 pre-release feature fixes, bugs and security fixes awaiting core review skip news topic-lazy-imports

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant