Skip to content

gh-152297: Reify dotted lazy imports with the full dotted name#152307

Draft
Kuhai9801 wants to merge 3 commits into
python:mainfrom
Kuhai9801:gh-152297-dotted-lazy-import-minimal
Draft

gh-152297: Reify dotted lazy imports with the full dotted name#152307
Kuhai9801 wants to merge 3 commits into
python:mainfrom
Kuhai9801:gh-152297-dotted-lazy-import-minimal

Conversation

@Kuhai9801

Copy link
Copy Markdown

For lazy import pkg.sub, the reifier shortened the name passed to __import__ to pkg. Eager import pkg.sub passes pkg.sub and lets the import protocol return the object to bind.

Pass the stored full import name during lazy reification. Add regressions for custom __import__ hooks and for loading the submodule on first use.

Tests:

  • git diff --check
  • python -m py_compile Lib/test/test_lazy_import/__init__.py

@python-cla-bot

python-cla-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

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.

1 participant