René's URL Explorer Experiment


Title: gh-153236: Propagate lazy submodule import errors by pablogsal · Pull Request #153237 · python/cpython · GitHub

Open Graph Title: gh-153236: Propagate lazy submodule import errors by pablogsal · Pull Request #153237 · python/cpython

X Title: gh-153236: Propagate lazy submodule import errors by pablogsal · Pull Request #153237 · python/cpython

Description: 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. Issue: gh-153236

Open Graph Description: 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, s...

X Description: 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, s...

Opengraph URL: https://github.com/python/cpython/pull/153237

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:0e2ee79c-0b07-bc77-37c7-29ef8ade02fc
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id83E2:31E99C:3475F4E:45F8170:6B01FF3C
html-safe-nonceea72aca5faa79a9d748627bbfebc56112bbe73f21dfb41ac419d088a749d5e2a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4M0UyOjMxRTk5QzozNDc1RjRFOjQ1RjgxNzA6NkIwMUZGM0MiLCJ2aXNpdG9yX2lkIjoiNDAxMjcyODYxNTc2OTg2NjA0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacd1f4ed3b2a6be482191cd1ac21278cdd96892171986150599d06bef27b92c67d
hovercard-subject-tagpull_request:4002702937
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/153237/files
twitter:imagehttps://avatars.githubusercontent.com/u/11718525?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/11718525?s=400&v=4
og:image:altI 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, s...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/153237/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F153237%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F153237%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/153237/files
Reloadhttps://github.com/python/cpython/pull/153237/files
Reloadhttps://github.com/python/cpython/pull/153237/files
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
pablogsalhttps://github.com/pablogsal
python:mainhttps://github.com/python/cpython/tree/main
pablogsal:gh-153236-lazy-submodule-errorshttps://github.com/pablogsal/cpython/tree/gh-153236-lazy-submodule-errors
Conversation 3 https://github.com/python/cpython/pull/153237
Commits 1 https://github.com/python/cpython/pull/153237/commits
Checks 56 https://github.com/python/cpython/pull/153237/checks
Files changed https://github.com/python/cpython/pull/153237/files
Please reload this pagehttps://github.com/python/cpython/pull/153237/files
gh-153236: Propagate lazy submodule import errors https://github.com/python/cpython/pull/153237/files#top
Show all changes 1 commit https://github.com/python/cpython/pull/153237/files
9a64b35 gh-153236: Propagate lazy submodule import errors pablogsal Jul 6, 2026 https://github.com/python/cpython/pull/153237/commits/9a64b352ed3fd34defa6a499155cbe22ea498740
Clear filters https://github.com/python/cpython/pull/153237/files
Please reload this pagehttps://github.com/python/cpython/pull/153237/files
Please reload this pagehttps://github.com/python/cpython/pull/153237/files
pycore_global_objects_fini_generated.h https://github.com/python/cpython/pull/153237/files#diff-31f682b2a04cda997f449a9816ee5fae305e3bfa7357afcb794615921c6a88d2
pycore_global_strings.h https://github.com/python/cpython/pull/153237/files#diff-7656e411eccd63ff8aab3e11de3f45035665f6b639206d3f440727dfb5e0ebcf
pycore_import.h https://github.com/python/cpython/pull/153237/files#diff-f0d0635a621a67c4105f6b306ecabc7b6f8e1fe1518ae49baf006c26f71520b5
pycore_runtime_init_generated.h https://github.com/python/cpython/pull/153237/files#diff-69a1fc720f0b1e9005cf7717dd81c823399da81dd2f6480664b51238c1ef93f0
pycore_unicodeobject_generated.h https://github.com/python/cpython/pull/153237/files#diff-510f6084b63d39305481b719ae0a29475ba759e259a8e4cee4f07c451ffbb2d6
_bootstrap.py https://github.com/python/cpython/pull/153237/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
__init__.py https://github.com/python/cpython/pull/153237/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
missing_dependency.py https://github.com/python/cpython/pull/153237/files#diff-1ab1221bf122d43736a9c29e6b89bb1e8445585f928d8ad099788f8ecc9316f1
self_named_module_not_found.py https://github.com/python/cpython/pull/153237/files#diff-f3fba0230219418ce167f1c3e6973bbc771bd3c506245deb97ea451ca6978d4f
2026-07-06-16-30-00.gh-issue-153236.lazy-import-errors.rst https://github.com/python/cpython/pull/153237/files#diff-217725c0cae69a3458929aea29181e7e9e5c1d4498c83b2c57fd10b645a1486a
moduleobject.c https://github.com/python/cpython/pull/153237/files#diff-8c2a0fd137780a0ee11c19aae8e46e8490f7667698cd78a5bde466bc995a08c5
import.c https://github.com/python/cpython/pull/153237/files#diff-28cfc3e2868980a79d93d2ebdc8747dcb9231f3dd7f2caef96e74107d1ea3bf3
Include/internal/pycore_global_objects_fini_generated.hhttps://github.com/python/cpython/pull/153237/files#diff-31f682b2a04cda997f449a9816ee5fae305e3bfa7357afcb794615921c6a88d2
View file https://github.com/pablogsal/cpython/blob/9a64b352ed3fd34defa6a499155cbe22ea498740/Include/internal/pycore_global_objects_fini_generated.h
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/python/cpython/pull/153237/files
Include/internal/pycore_global_strings.hhttps://github.com/python/cpython/pull/153237/files#diff-7656e411eccd63ff8aab3e11de3f45035665f6b639206d3f440727dfb5e0ebcf
View file https://github.com/pablogsal/cpython/blob/9a64b352ed3fd34defa6a499155cbe22ea498740/Include/internal/pycore_global_strings.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/153237/{{ revealButtonHref }}
https://github.com/python/cpython/pull/153237/files#diff-7656e411eccd63ff8aab3e11de3f45035665f6b639206d3f440727dfb5e0ebcf
https://github.com/python/cpython/pull/153237/files#diff-7656e411eccd63ff8aab3e11de3f45035665f6b639206d3f440727dfb5e0ebcf
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L261
Include/internal/pycore_import.hhttps://github.com/python/cpython/pull/153237/files#diff-f0d0635a621a67c4105f6b306ecabc7b6f8e1fe1518ae49baf006c26f71520b5
View file https://github.com/pablogsal/cpython/blob/9a64b352ed3fd34defa6a499155cbe22ea498740/Include/internal/pycore_import.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/153237/{{ revealButtonHref }}
https://github.com/python/cpython/pull/153237/files#diff-f0d0635a621a67c4105f6b306ecabc7b6f8e1fe1518ae49baf006c26f71520b5
https://github.com/python/cpython/pull/153237/files#diff-f0d0635a621a67c4105f6b306ecabc7b6f8e1fe1518ae49baf006c26f71520b5
Include/internal/pycore_runtime_init_generated.hhttps://github.com/python/cpython/pull/153237/files#diff-69a1fc720f0b1e9005cf7717dd81c823399da81dd2f6480664b51238c1ef93f0
View file https://github.com/pablogsal/cpython/blob/9a64b352ed3fd34defa6a499155cbe22ea498740/Include/internal/pycore_runtime_init_generated.h
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/python/cpython/pull/153237/files
Include/internal/pycore_unicodeobject_generated.hhttps://github.com/python/cpython/pull/153237/files#diff-510f6084b63d39305481b719ae0a29475ba759e259a8e4cee4f07c451ffbb2d6
View file https://github.com/pablogsal/cpython/blob/9a64b352ed3fd34defa6a499155cbe22ea498740/Include/internal/pycore_unicodeobject_generated.h
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/python/cpython/pull/153237/files
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L261
Lib/importlib/_bootstrap.pyhttps://github.com/python/cpython/pull/153237/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
View file https://github.com/pablogsal/cpython/blob/9a64b352ed3fd34defa6a499155cbe22ea498740/Lib/importlib/_bootstrap.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/153237/{{ revealButtonHref }}
https://github.com/python/cpython/pull/153237/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
https://github.com/python/cpython/pull/153237/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
https://github.com/python/cpython/pull/153237/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
https://github.com/python/cpython/pull/153237/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
https://github.com/python/cpython/pull/153237/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
https://github.com/python/cpython/pull/153237/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
https://github.com/python/cpython/pull/153237/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
https://github.com/python/cpython/pull/153237/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
https://github.com/python/cpython/pull/153237/files#diff-dba786ae26d5505c4c367a93b1179c2f80f2433d983b84bacb9001fb552f0761
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L299
Lib/test/test_lazy_import/__init__.pyhttps://github.com/python/cpython/pull/153237/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
View file https://github.com/pablogsal/cpython/blob/9a64b352ed3fd34defa6a499155cbe22ea498740/Lib/test/test_lazy_import/__init__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/153237/{{ revealButtonHref }}
https://github.com/python/cpython/pull/153237/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
https://github.com/python/cpython/pull/153237/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
https://github.com/python/cpython/pull/153237/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L299
Lib/test/test_lazy_import/data/missing_dependency.pyhttps://github.com/python/cpython/pull/153237/files#diff-1ab1221bf122d43736a9c29e6b89bb1e8445585f928d8ad099788f8ecc9316f1
View file https://github.com/pablogsal/cpython/blob/9a64b352ed3fd34defa6a499155cbe22ea498740/Lib/test/test_lazy_import/data/missing_dependency.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/153237/{{ revealButtonHref }}
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L299
Lib/test/test_lazy_import/data/self_named_module_not_found.pyhttps://github.com/python/cpython/pull/153237/files#diff-f3fba0230219418ce167f1c3e6973bbc771bd3c506245deb97ea451ca6978d4f
View file https://github.com/pablogsal/cpython/blob/9a64b352ed3fd34defa6a499155cbe22ea498740/Lib/test/test_lazy_import/data/self_named_module_not_found.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/153237/{{ revealButtonHref }}
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L261
...xt/Core_and_Builtins/2026-07-06-16-30-00.gh-issue-153236.lazy-import-errors.rsthttps://github.com/python/cpython/pull/153237/files#diff-217725c0cae69a3458929aea29181e7e9e5c1d4498c83b2c57fd10b645a1486a
View file https://github.com/pablogsal/cpython/blob/9a64b352ed3fd34defa6a499155cbe22ea498740/Misc/NEWS.d/next/Core_and_Builtins/2026-07-06-16-30-00.gh-issue-153236.lazy-import-errors.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/153237/{{ revealButtonHref }}
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L267
Objects/moduleobject.chttps://github.com/python/cpython/pull/153237/files#diff-8c2a0fd137780a0ee11c19aae8e46e8490f7667698cd78a5bde466bc995a08c5
View file https://github.com/pablogsal/cpython/blob/9a64b352ed3fd34defa6a499155cbe22ea498740/Objects/moduleobject.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/153237/{{ revealButtonHref }}
https://github.com/python/cpython/pull/153237/files#diff-8c2a0fd137780a0ee11c19aae8e46e8490f7667698cd78a5bde466bc995a08c5
https://github.com/python/cpython/pull/153237/files#diff-8c2a0fd137780a0ee11c19aae8e46e8490f7667698cd78a5bde466bc995a08c5
https://github.com/python/cpython/pull/153237/files#diff-8c2a0fd137780a0ee11c19aae8e46e8490f7667698cd78a5bde466bc995a08c5
Please reload this pagehttps://github.com/python/cpython/pull/153237/files
Please reload this pagehttps://github.com/python/cpython/pull/153237/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.