Skip to content

lazy imports allow lazy import math.pi #155194

Description

@DinoV

Bug report

Bug description:

lazy import math.pi
print(math.pi)

as reported: https://discuss.python.org/t/sys-lazy-modules-clarification/108385

This is a big difference in that we allow these in lazy imports but not normal imports. It's also due to just a bunch of extra unnecessary logic. Fixing this now seems like it'd be better than letting people start doing this.

CPython versions tested on:

3.15

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Aug 4, 2026
  2. self-assigned this
    on Aug 4, 2026
  3. encukou commented on Aug 11, 2026

    @encukou
    Member

    Hugo said:

    Yes, let's fix this for rc2, and do it in main first.

    I'll mark this as a release blocker for visibility.

  4. added a commit that references this issue on Aug 14, 2026
  5. added a commit that references this issue on Aug 19, 2026
  6. encukou commented on Aug 21, 2026

    @encukou
    Member

    Thank you for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.15bugs and security fixes3.16new features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)release-blockertopic-lazy-importstype-bugAn unexpected behavior, bug, or error

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions