René's URL Explorer Experiment


Title: gh-117953: Track All Extension Modules by ericsnowcurrently · Pull Request #118156 · python/cpython · GitHub

Open Graph Title: gh-117953: Track All Extension Modules by ericsnowcurrently · Pull Request #118156 · python/cpython

X Title: gh-117953: Track All Extension Modules by ericsnowcurrently · Pull Request #118156 · python/cpython

Description: When an extension module is loaded, the init function is looked up and run. If that doesn't fail then the module is "fixed up", which includes adding its PyModuleDef to a global mapping that is used if the module is re-loaded. However, that has not applied to multi-phase init modules. Adding those modules to the global mapping would identify that we already loaded the module (or at least tried), as well as the module's kind. That's especially useful for a follow up PR I have planned. (This is based on gh-118116. For the diff, see my track-all-ext-modules branch.) Issue: gh-117953

Open Graph Description: When an extension module is loaded, the init function is looked up and run. If that doesn't fail then the module is "fixed up", which includes adding its PyModuleDef to a global mapp...

X Description: When an extension module is loaded, the init function is looked up and run. If that doesn't fail then the module is "fixed up", which includes adding its PyModuleDef to a...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/commits/:range(.:format)
route-controllerpull_requests
route-actioncommits
fetch-noncev2:466dedb9-3f70-fccb-bab0-274e4fc7f274
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC9CE:2EC24D:9283ED2:C75B686:6996BBE0
html-safe-noncec371c4434e53d4c7434333686ca8eac30129759397a8391916323cab371a8223
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUNFOjJFQzI0RDo5MjgzRUQyOkM3NUI2ODY6Njk5NkJCRTAiLCJ2aXNpdG9yX2lkIjoiNzYwMzgzOTU5MTg1NTM0MDUxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac9aa28d02e3e739f0d567565d99aa73c4db0295b32e129a0eafca7745348909ae
hovercard-subject-tagpull_request:1834889551
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/commits
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a
twitter:imagehttps://avatars.githubusercontent.com/u/1152074?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1152074?s=400&v=4
og:image:altWhen an extension module is loaded, the init function is looked up and run. If that doesn't fail then the module is "fixed up", which includes adding its PyModuleDef to a global mapp...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None5513290f8d09a9ed78de519ab8316ed23b2b0ddd5e91d2420df56691d00827e8
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee258e32a8c50a12656030b21f3279030a774ec82
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F118156%2Fcommits%2F694a76345e8cc4a6c69403ebf244269669386c9a
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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/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%2F118156%2Fcommits%2F694a76345e8cc4a6c69403ebf244269669386c9a
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%2Fcommits&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a
Reloadhttps://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a
Reloadhttps://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 34.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.6k 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.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security 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 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
ericsnowcurrentlyhttps://github.com/ericsnowcurrently
python:mainhttps://github.com/python/cpython/tree/main
ericsnowcurrently:track-all-ext-moduleshttps://github.com/ericsnowcurrently/cpython/tree/track-all-ext-modules
Conversation 0 https://github.com/python/cpython/pull/118156
Commits 44 https://github.com/python/cpython/pull/118156/commits
Checks 0 https://github.com/python/cpython/pull/118156/checks
Files changed https://github.com/python/cpython/pull/118156/files
Please reload this pagehttps://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a
gh-117953: Track All Extension Modules https://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a#top
Show all changes 44 commits https://github.com/python/cpython/pull/118156/files
cc67849 Factor out _PyImport_RunDynamicModule(). ericsnowcurrently Feb 8, 2024 https://github.com/python/cpython/pull/118156/commits/cc6784962b59f12e4d94d67fe6885d8e02776b20
2e5ecde Drop _PyImport_LoadDynamicModuleWithSpec(). ericsnowcurrently Feb 8, 2024 https://github.com/python/cpython/pull/118156/commits/2e5ecde7e210eae8636f0b7300330eef2ccb96a4
b810cd8 Add an assert. ericsnowcurrently Feb 8, 2024 https://github.com/python/cpython/pull/118156/commits/b810cd8ae42ca37a0977d596f2fc75fa6243805f
8d0ef38 Factor out fix_up_extension_for_interpreter(). ericsnowcurrently Feb 8, 2024 https://github.com/python/cpython/pull/118156/commits/8d0ef38d53c565b17fa4d49a0be2ecf86edf85d3
7f930cc Do _extensions_cache_set() first. ericsnowcurrently Feb 8, 2024 https://github.com/python/cpython/pull/118156/commits/7f930ccdfdb720fc344a55ab5ce1523e46027e4f
1ffeaef Calculate path_bytes ahead of time. ericsnowcurrently Apr 16, 2024 https://github.com/python/cpython/pull/118156/commits/1ffeaef7f8f1ed1082de6cc5170ce3f3733b3965
7500285 Move the audit entry to _imp_create_dynamic_impl(). ericsnowcurrently Apr 16, 2024 https://github.com/python/cpython/pull/118156/commits/7500285cbd722de6670524dbcc01f3d534aeb036
3c0b170 _Py_ext_module_loader_info_from_spec() -> _Py_ext_module_loader_info_… ericsnowcurrently Apr 16, 2024 https://github.com/python/cpython/pull/118156/commits/3c0b1700ad0bf546d27df8637887360d9e37743c
02e24cc Add info.newcontext. ericsnowcurrently Apr 16, 2024 https://github.com/python/cpython/pull/118156/commits/02e24ccd22fe609b2d45ba4a1ab2ee128c7337b3
ba5ffa7 Split up _PyImport_RunDynamicModule() along cross-interpreter-safe bo… ericsnowcurrently Apr 16, 2024 https://github.com/python/cpython/pull/118156/commits/ba5ffa78bc983ccc06bb32ea16c42aaa51143da0
b895966 Drop _PyImport_RunDynamicModule(). ericsnowcurrently Apr 16, 2024 https://github.com/python/cpython/pull/118156/commits/b89596625b1977f59a3cd7c08ac0f7988c1c04d4
76fa273 Always close the file handle. ericsnowcurrently Apr 16, 2024 https://github.com/python/cpython/pull/118156/commits/76fa2735568194838576659d0a39008df8c7d374
1e936c5 Revert the fclose() change. ericsnowcurrently Apr 16, 2024 https://github.com/python/cpython/pull/118156/commits/1e936c5084fc61e06d14b9971d8b5f84cfb8a792
6bb07b9 Factor out create_dynamic(). ericsnowcurrently Apr 16, 2024 https://github.com/python/cpython/pull/118156/commits/6bb07b94720fa4479042a1a274ae8a40875091de
2705e65 Drop _PyImport_FixupExtensionObject(). ericsnowcurrently Apr 16, 2024 https://github.com/python/cpython/pull/118156/commits/2705e6598e3f37db1b432cb888a4e4af36297ad3
98d8b4b Move setting __file__ to fix_up_extension(). ericsnowcurrently Apr 17, 2024 https://github.com/python/cpython/pull/118156/commits/98d8b4b0b78339bb7911dc57d833bd95640ce7eb
ddf1135 Pass tstate through to fix_up_extension(). ericsnowcurrently Apr 17, 2024 https://github.com/python/cpython/pull/118156/commits/ddf113535b41d211cc8e8db43492303e6416333a
694a763 Add a note about _PyImport_FixupBuiltin(). ericsnowcurrently Apr 17, 2024 https://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a
72e0d73 Always expect a valid modules dict passed to fix_up_extension(). ericsnowcurrently Apr 17, 2024 https://github.com/python/cpython/pull/118156/commits/72e0d73c0e3b18894d34a027cf75f5e1111fbc82
3f14a67 Factor out reload_singlephase_extension(). ericsnowcurrently Apr 17, 2024 https://github.com/python/cpython/pull/118156/commits/3f14a67fa7bb8056fc630e914d0053570d52742e
b5f5868 res.singlephase -> res.kind ericsnowcurrently Apr 17, 2024 https://github.com/python/cpython/pull/118156/commits/b5f58682bbfb8a09f51416b519c60cabdc8550a4
a5f7535 Factor out _extensions_cache_init(). ericsnowcurrently Apr 17, 2024 https://github.com/python/cpython/pull/118156/commits/a5f7535f9bb9e83bed392250d8f90000d4177936
e8d674a Factor out _extensions_cache_find_unlocked(). ericsnowcurrently Apr 17, 2024 https://github.com/python/cpython/pull/118156/commits/e8d674a856cda44a2c2e468358743812d1a54c51
27b365d Use _PyImport_RunModInitFunc() in create_builtin(). ericsnowcurrently Apr 18, 2024 https://github.com/python/cpython/pull/118156/commits/27b365df6a43cffbfa39b843c5e2bcab0ec608ab
5128702 Clean up _PyImport_FixupBuiltin(). ericsnowcurrently Apr 18, 2024 https://github.com/python/cpython/pull/118156/commits/512870232a57b4467b4423307241fbed1ee7866c
aaec360 Add some asserts to _PyImport_RunModInitFunc(). ericsnowcurrently Apr 18, 2024 https://github.com/python/cpython/pull/118156/commits/aaec36055a866b96c8f262f1ccb4c5dc0513f666
f97671e Drop the replace arg to _extensions_cache_set(). ericsnowcurrently Apr 18, 2024 https://github.com/python/cpython/pull/118156/commits/f97671ef08b97f1e3e6bd0f9b4e50d3c53ffe578
2366983 Check the module returned by import_find_extension() to ensure single… ericsnowcurrently Apr 18, 2024 https://github.com/python/cpython/pull/118156/commits/23669837d2c3006556247c4f2738b3ea83706bea
d5039ea Allow mod->md_def to be NULL. ericsnowcurrently Apr 19, 2024 https://github.com/python/cpython/pull/118156/commits/d5039eac961d4cc7d1e7c90c5d7211fc893ce12f
67d217b Call _PyImport_RunModInitFunc() in reload_singlephase_extension(). ericsnowcurrently Apr 19, 2024 https://github.com/python/cpython/pull/118156/commits/67d217b270b21acc35374ad277c67bdc97ab8085
9e40287 res->err is an array, not just a pointer. ericsnowcurrently Apr 19, 2024 https://github.com/python/cpython/pull/118156/commits/9e40287d0333d2b7e0c3ad2ab8177f50d29d233c
b8c2a1d Factor out import_run_extension() (and drop create_dynamic()). ericsnowcurrently Apr 18, 2024 https://github.com/python/cpython/pull/118156/commits/b8c2a1d0adc282afc61915743dcf3a7746ab5586
967c649 Factor out update_extension_cache() and drop fix_up_extension_for_int… ericsnowcurrently Apr 19, 2024 https://github.com/python/cpython/pull/118156/commits/967c649f6ed1007eeb30a63d9a28d4a57167525c
aecf56c We already know the def is okay. ericsnowcurrently Apr 19, 2024 https://github.com/python/cpython/pull/118156/commits/aecf56caa0d039feb031d0ecff6c30a870aaf50f
0d03d23 Revive fix_up_extension_for_interpreter(). ericsnowcurrently Apr 19, 2024 https://github.com/python/cpython/pull/118156/commits/0d03d2308cd9bfb5312d9d652ddce190f22e0e9a
cace102 Add a distinct _Py_ext_module_loader_info.path (and old path -> filen… ericsnowcurrently Apr 19, 2024 https://github.com/python/cpython/pull/118156/commits/cace1022c03527d6c36877e6700bbb2c9566d9e4
3cf0db0 Do not call update_extensions_cache() in fix_up_extension(). ericsnowcurrently Apr 19, 2024 https://github.com/python/cpython/pull/118156/commits/3cf0db087b9986765807e5ca136ab5a6489a11a7
9b3088a Let the modules arg to fix_up_extension_for_interpreter() be NULL. ericsnowcurrently Apr 19, 2024 https://github.com/python/cpython/pull/118156/commits/9b3088a6b2312a153e1bdaa6b192e96697e9039b
4ac1644 Let the caller of update_extensions_cache() decide if m_copy should b… ericsnowcurrently Apr 19, 2024 https://github.com/python/cpython/pull/118156/commits/4ac1644a3558e52bc74e9d85fe279593cf078214
393a177 Fix the update_extensions_cache() signature. ericsnowcurrently Apr 19, 2024 https://github.com/python/cpython/pull/118156/commits/393a177e8e3730852f99667b320ec497fea8c054
2969e4c Imply singlephase if the init func fails. ericsnowcurrently Apr 17, 2024 https://github.com/python/cpython/pull/118156/commits/2969e4c03faf73000ad1bc90aef1035c9fe012ff
93c7f79 Keep track of all module defs. ericsnowcurrently Apr 19, 2024 https://github.com/python/cpython/pull/118156/commits/93c7f79b9a38eb87f31a89586bda2b1c9f820aaa
cb2137e Fix the implementation. ericsnowcurrently Apr 18, 2024 https://github.com/python/cpython/pull/118156/commits/cb2137e429a7b9e7bac455159a9ab882d7b90b1d
895ce51 wip ericsnowcurrently Apr 18, 2024 https://github.com/python/cpython/pull/118156/commits/895ce51388441b682cca44e4f94948dc36eac394
Clear filters https://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a
Please reload this pagehttps://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a
Please reload this pagehttps://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a
Prev https://github.com/python/cpython/pull/118156/commits/ddf113535b41d211cc8e8db43492303e6416333a
Next https://github.com/python/cpython/pull/118156/commits/72e0d73c0e3b18894d34a027cf75f5e1111fbc82
Please reload this pagehttps://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a
https://github.com/ericsnowcurrently
ericsnowcurrentlyhttps://github.com/python/cpython/commits?author=ericsnowcurrently
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L261
Include/internal/pycore_import.hhttps://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a#diff-f0d0635a621a67c4105f6b306ecabc7b6f8e1fe1518ae49baf006c26f71520b5
View file https://github.com/python/cpython/blob/694a76345e8cc4a6c69403ebf244269669386c9a/Include/internal/pycore_import.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/118156/commits/{{ revealButtonHref }}
https://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a#diff-f0d0635a621a67c4105f6b306ecabc7b6f8e1fe1518ae49baf006c26f71520b5
https://github.com/python/cpython/pull/118156/commits/694a76345e8cc4a6c69403ebf244269669386c9a#diff-f0d0635a621a67c4105f6b306ecabc7b6f8e1fe1518ae49baf006c26f71520b5
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.