René's URL Explorer Experiment


Title: gh-148587: Make `sys.lazy_modules` immutable by johnslavik · Pull Request #149408 · python/cpython · GitHub

Open Graph Title: gh-148587: Make `sys.lazy_modules` immutable by johnslavik · Pull Request #149408 · python/cpython

X Title: gh-148587: Make `sys.lazy_modules` immutable by johnslavik · Pull Request #149408 · python/cpython

Description: Feel free to chime in with criticism. I'm not sure this is it yet, but take it in your own hands if you want. Issue: gh-148587

Open Graph Description: Feel free to chime in with criticism. I'm not sure this is it yet, but take it in your own hands if you want. Issue: gh-148587

X Description: Feel free to chime in with criticism. I'm not sure this is it yet, but take it in your own hands if you want. Issue: gh-148587

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:00750465-6cab-250a-dda0-b3f539244214
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA65C:2BB8A0:B91B06:10CDB8F:6A562308
html-safe-nonceb1715bf739e431f26776409ee9259349186ddec19bda26196ea04e9fbbed8466
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjVDOjJCQjhBMDpCOTFCMDY6MTBDREI4Rjo2QTU2MjMwOCIsInZpc2l0b3JfaWQiOiI1ODY1OTcwMzk3OTc2MzM5MjA4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3cf34ade3ae75d418e7326bbd3df30352e416a9259866bc71b31921bd8c65f82
hovercard-subject-tagpull_request:3630141928
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/149408/files
twitter:imagehttps://avatars.githubusercontent.com/u/64036239?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/64036239?s=400&v=4
og:image:altFeel free to chime in with criticism. I'm not sure this is it yet, but take it in your own hands if you want. Issue: gh-148587
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneeeb71977be324ce2bc7c4afd597296b8e3527d8922ad94632edd7a7296f8031b
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
release3e7957744c8a44d05ff1e464dc5d119e60b98fae
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/149408/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F149408%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F149408%2Ffiles
Sign up https://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/149408/files
Reloadhttps://github.com/python/cpython/pull/149408/files
Reloadhttps://github.com/python/cpython/pull/149408/files
Please reload this pagehttps://github.com/python/cpython/pull/149408/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/149408/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.8k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.3k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
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
johnslavikhttps://github.com/johnslavik
python:mainhttps://github.com/python/cpython/tree/main
johnslavik:gh-148587-revamp-sys-lazy-moduleshttps://github.com/johnslavik/cpython/tree/gh-148587-revamp-sys-lazy-modules
Conversation 2 https://github.com/python/cpython/pull/149408
Commits 14 https://github.com/python/cpython/pull/149408/commits
Checks 51 https://github.com/python/cpython/pull/149408/checks
Files changed https://github.com/python/cpython/pull/149408/files
Please reload this pagehttps://github.com/python/cpython/pull/149408/files
gh-148587: Make sys.lazy_modules immutable https://github.com/python/cpython/pull/149408/files#top
Show all changes 14 commits https://github.com/python/cpython/pull/149408/files
351473b gh-148587: Make sys.lazy_modules an immutable frozendict snapshot johnslavik Apr 26, 2026 https://github.com/python/cpython/pull/149408/commits/351473b6a188a71acd0524b00f19bb2577e6b1c1
083bbe9 gh-148587: Expose live lazy import registry as sys._lazy_modules johnslavik May 4, 2026 https://github.com/python/cpython/pull/149408/commits/083bbe99cf66881ca407bdf5e81b4f4c569e2521
eac60ed gh-148587: Address review feedback on sys.lazy_modules johnslavik May 5, 2026 https://github.com/python/cpython/pull/149408/commits/eac60ede1e87f8eab8008a2a79a1e7e00a256bfb
0424a64 gh-148587: Trim sys.lazy_modules contract test and NEWS johnslavik May 5, 2026 https://github.com/python/cpython/pull/149408/commits/0424a64806a0eb2c2ed31a85d7faf204dd4c6401
4404972 gh-148587: Align sys.__getattr__ with _ctypes/zlib pattern johnslavik May 5, 2026 https://github.com/python/cpython/pull/149408/commits/44049725abc3360b01a42f391dad5161ef317312
f4f8fb2 gh-148587: Use METH_VARARGS for sys.__getattr__ johnslavik May 5, 2026 https://github.com/python/cpython/pull/149408/commits/f4f8fb2a47c07af69f7d8c724e55cb7a741c0f1a
a94f4e7 gh-148587: Pre-size and short-circuit empty in lazy modules snapshot johnslavik May 5, 2026 https://github.com/python/cpython/pull/149408/commits/a94f4e7a6672819948c173088688b17859ccf127
926a02e Revert pre-size and empty fast path in lazy modules snapshot johnslavik May 5, 2026 https://github.com/python/cpython/pull/149408/commits/926a02eecdd6e9a8d2c7d92641e3a02fbe738121
ca32d07 Add docstring to sys.__getattr__ johnslavik May 5, 2026 https://github.com/python/cpython/pull/149408/commits/ca32d07bedc36ebb269f473fff119ce0cd34937b
3dff9ef Add sys.__dir__ so lazy_modules appears in tab completion johnslavik May 5, 2026 https://github.com/python/cpython/pull/149408/commits/3dff9ef08fa8da73080233945f573e8951e36ed9
2c0e3f2 Fix METH_NOARGS signature and wrap long line in sys_dir/sys_getattr johnslavik May 5, 2026 https://github.com/python/cpython/pull/149408/commits/2c0e3f2d8e89c28c7334d7ed493ec841cc55a4e1
17de69e Add sys.lazy_modules docs and fix CI test failures johnslavik May 5, 2026 https://github.com/python/cpython/pull/149408/commits/17de69ef42653eb42c32f82f818affa1f6bda1cd
46c6033 Remove internal _lazy_modules mention and bogus set_lazy_imports cros… johnslavik May 5, 2026 https://github.com/python/cpython/pull/149408/commits/46c6033a5eb6efb6944671a9fe6f759685ecac7c
e4bbea8 Fix test_sys_module_has_signatures: METH_NOARGS never has None text s… johnslavik May 17, 2026 https://github.com/python/cpython/pull/149408/commits/e4bbea82f46adf4ac426c1f400bfb45f948a15f4
Clear filters https://github.com/python/cpython/pull/149408/files
Please reload this pagehttps://github.com/python/cpython/pull/149408/files
Please reload this pagehttps://github.com/python/cpython/pull/149408/files
sys.rst https://github.com/python/cpython/pull/149408/files#diff-26fe9050845b6be0f74760ffe9095874cfe2dfec55c22b18e7dba58f3978a418
pycore_import.h https://github.com/python/cpython/pull/149408/files#diff-f0d0635a621a67c4105f6b306ecabc7b6f8e1fe1518ae49baf006c26f71520b5
test_builtin.py https://github.com/python/cpython/pull/149408/files#diff-f23235c1f5dea0e2d79b33a58e00025ad3c440f96bb76013a1a37868e70a776b
test_inspect.py https://github.com/python/cpython/pull/149408/files#diff-92d8ecc68ed9e7ce3b31a764d5b0368db1514365c2a6433bbe3bad5c3210cea0
__init__.py https://github.com/python/cpython/pull/149408/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
2026-04-26-20-44-58.gh-issue-148587.f791BR.rst https://github.com/python/cpython/pull/149408/files#diff-fc8da8e4e240abbfdd86b52af6fde9aad9dccced6113cba2b7c162bc7d490419
import.c https://github.com/python/cpython/pull/149408/files#diff-28cfc3e2868980a79d93d2ebdc8747dcb9231f3dd7f2caef96e74107d1ea3bf3
sysmodule.c https://github.com/python/cpython/pull/149408/files#diff-a3a5c73931235f7f344c072dc755d6508e13923db3f5d581c5e88652075871cb
Doc/library/sys.rsthttps://github.com/python/cpython/pull/149408/files#diff-26fe9050845b6be0f74760ffe9095874cfe2dfec55c22b18e7dba58f3978a418
View file https://github.com/johnslavik/cpython/blob/e4bbea82f46adf4ac426c1f400bfb45f948a15f4/Doc/library/sys.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/149408/{{ revealButtonHref }}
https://github.com/python/cpython/pull/149408/files#diff-26fe9050845b6be0f74760ffe9095874cfe2dfec55c22b18e7dba58f3978a418
https://github.com/python/cpython/pull/149408/files#diff-26fe9050845b6be0f74760ffe9095874cfe2dfec55c22b18e7dba58f3978a418
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L264
Include/internal/pycore_import.hhttps://github.com/python/cpython/pull/149408/files#diff-f0d0635a621a67c4105f6b306ecabc7b6f8e1fe1518ae49baf006c26f71520b5
View file https://github.com/johnslavik/cpython/blob/e4bbea82f46adf4ac426c1f400bfb45f948a15f4/Include/internal/pycore_import.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/149408/{{ revealButtonHref }}
https://github.com/python/cpython/pull/149408/files#diff-f0d0635a621a67c4105f6b306ecabc7b6f8e1fe1518ae49baf006c26f71520b5
https://github.com/python/cpython/pull/149408/files#diff-f0d0635a621a67c4105f6b306ecabc7b6f8e1fe1518ae49baf006c26f71520b5
Lib/test/test_builtin.pyhttps://github.com/python/cpython/pull/149408/files#diff-f23235c1f5dea0e2d79b33a58e00025ad3c440f96bb76013a1a37868e70a776b
View file https://github.com/johnslavik/cpython/blob/e4bbea82f46adf4ac426c1f400bfb45f948a15f4/Lib/test/test_builtin.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/149408/{{ revealButtonHref }}
https://github.com/python/cpython/pull/149408/files#diff-f23235c1f5dea0e2d79b33a58e00025ad3c440f96bb76013a1a37868e70a776b
https://github.com/python/cpython/pull/149408/files#diff-f23235c1f5dea0e2d79b33a58e00025ad3c440f96bb76013a1a37868e70a776b
Lib/test/test_inspect/test_inspect.pyhttps://github.com/python/cpython/pull/149408/files#diff-92d8ecc68ed9e7ce3b31a764d5b0368db1514365c2a6433bbe3bad5c3210cea0
View file https://github.com/johnslavik/cpython/blob/e4bbea82f46adf4ac426c1f400bfb45f948a15f4/Lib/test/test_inspect/test_inspect.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/149408/{{ revealButtonHref }}
https://github.com/python/cpython/pull/149408/files#diff-92d8ecc68ed9e7ce3b31a764d5b0368db1514365c2a6433bbe3bad5c3210cea0
https://github.com/python/cpython/pull/149408/files#diff-92d8ecc68ed9e7ce3b31a764d5b0368db1514365c2a6433bbe3bad5c3210cea0
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L302
Lib/test/test_lazy_import/__init__.pyhttps://github.com/python/cpython/pull/149408/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
View file https://github.com/johnslavik/cpython/blob/e4bbea82f46adf4ac426c1f400bfb45f948a15f4/Lib/test/test_lazy_import/__init__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/149408/{{ revealButtonHref }}
https://github.com/python/cpython/pull/149408/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
https://github.com/python/cpython/pull/149408/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
https://github.com/python/cpython/pull/149408/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
https://github.com/python/cpython/pull/149408/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
https://github.com/python/cpython/pull/149408/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
https://github.com/python/cpython/pull/149408/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
https://github.com/python/cpython/pull/149408/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
https://github.com/python/cpython/pull/149408/files#diff-9c7ed57cb280bfcf280bf31daf9747c91ca26b50196a9f84c1a38f105d83b31e
Misc/NEWS.d/next/Core_and_Builtins/2026-04-26-20-44-58.gh-issue-148587.f791BR.rsthttps://github.com/python/cpython/pull/149408/files#diff-fc8da8e4e240abbfdd86b52af6fde9aad9dccced6113cba2b7c162bc7d490419
View file https://github.com/johnslavik/cpython/blob/e4bbea82f46adf4ac426c1f400bfb45f948a15f4/Misc/NEWS.d/next/Core_and_Builtins/2026-04-26-20-44-58.gh-issue-148587.f791BR.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/149408/{{ revealButtonHref }}
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L265
Python/import.chttps://github.com/python/cpython/pull/149408/files#diff-28cfc3e2868980a79d93d2ebdc8747dcb9231f3dd7f2caef96e74107d1ea3bf3
View file https://github.com/johnslavik/cpython/blob/e4bbea82f46adf4ac426c1f400bfb45f948a15f4/Python/import.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/149408/{{ revealButtonHref }}
https://github.com/python/cpython/pull/149408/files#diff-28cfc3e2868980a79d93d2ebdc8747dcb9231f3dd7f2caef96e74107d1ea3bf3
https://github.com/python/cpython/pull/149408/files#diff-28cfc3e2868980a79d93d2ebdc8747dcb9231f3dd7f2caef96e74107d1ea3bf3
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L247
Python/sysmodule.chttps://github.com/python/cpython/pull/149408/files#diff-a3a5c73931235f7f344c072dc755d6508e13923db3f5d581c5e88652075871cb
View file https://github.com/johnslavik/cpython/blob/e4bbea82f46adf4ac426c1f400bfb45f948a15f4/Python/sysmodule.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/149408/{{ revealButtonHref }}
https://github.com/python/cpython/pull/149408/files#diff-a3a5c73931235f7f344c072dc755d6508e13923db3f5d581c5e88652075871cb
https://github.com/python/cpython/pull/149408/files#diff-a3a5c73931235f7f344c072dc755d6508e13923db3f5d581c5e88652075871cb
https://github.com/python/cpython/pull/149408/files#diff-a3a5c73931235f7f344c072dc755d6508e13923db3f5d581c5e88652075871cb
https://github.com/python/cpython/pull/149408/files#diff-a3a5c73931235f7f344c072dc755d6508e13923db3f5d581c5e88652075871cb
Please reload this pagehttps://github.com/python/cpython/pull/149408/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.