Skip to content

gh-153236: Propagate lazy submodule import errors#153237

Open
pablogsal wants to merge 1 commit into
python:mainfrom
pablogsal:gh-153236-lazy-submodule-errors
Open

gh-153236: Propagate lazy submodule import errors#153237
pablogsal wants to merge 1 commit into
python:mainfrom
pablogsal:gh-153236-lazy-submodule-errors

Conversation

@pablogsal

@pablogsal pablogsal commented Jul 6, 2026

Copy link
Copy Markdown
Member

I have chosen to make lazy submodule resolution explicit instead of classifying the exception after a failed import. A real module can raise ModuleNotFoundError with its own name while executing, so the exception doesn reliably tell us whether the finder failed or the loader failed.

I think the superior way here is to do this in importlib's find/load boundary. No spec means the lazy submodule is absent and attribute lookup can continue. Once a spec exists, the submodule is real, so any later exception propagates normally.

@pablogsal

Copy link
Copy Markdown
Member Author

CC @brittanyrey

@pablogsal pablogsal force-pushed the gh-153236-lazy-submodule-errors branch from 9a3039d to 1c296cf Compare July 6, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant