René's URL Explorer Experiment


Title: GH-118761: Expose more core interpreter types in ``_types`` by AA-Turner · Pull Request #132103 · python/cpython · GitHub

Open Graph Title: GH-118761: Expose more core interpreter types in ``_types`` by AA-Turner · Pull Request #132103 · python/cpython

X Title: GH-118761: Expose more core interpreter types in ``_types`` by AA-Turner · Pull Request #132103 · python/cpython

Description: This was discussed in #131969 (cc @ZeroIntensity), but deferred to get the smaller change in. This PR adds all of the core interpreter types currently exposed in the types module to _typesmodule.c. We then change the definition of types.py to prefer these, but if the _types module is not available, to use the pure-Python fallbacks. Strictly, this isn't needed, as _types is a built-in module. I think it might be helpful to keep the pure Python definitions for other implementations (PyPy, etc), and perhaps as a quick reminder of what each type looks like. Open to thoughts on this, as it would clearly be simpler to replace everything with from _types import *. I've initially categorised this under #118761, as this does provide a ~15% speed-up for me (1627µs to 1403µs). A Issue: gh-118761

Open Graph Description: This was discussed in #131969 (cc @ZeroIntensity), but deferred to get the smaller change in. This PR adds all of the core interpreter types currently exposed in the types module to _typesmodule.c....

X Description: This was discussed in #131969 (cc @ZeroIntensity), but deferred to get the smaller change in. This PR adds all of the core interpreter types currently exposed in the types module to _typesmodule.c....

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:373dfad6-09bf-dc15-8509-707b1fb0a60a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB062:861EA:14C5553:1BF3749:6969B2D0
html-safe-nonced5128bfc0a01fd24fa9378eb8b76bc227ec54627758849debac29931eeb42547
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDYyOjg2MUVBOjE0QzU1NTM6MUJGMzc0OTo2OTY5QjJEMCIsInZpc2l0b3JfaWQiOiIyNjMzMjA0NTMzNTIwMDg1NzEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac922bae13a2f919e0eb9858527e004d3b8e9d84f8e3d5402e0882dcc861c0b30a
hovercard-subject-tagpull_request:2440634497
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/132103/files
twitter:imagehttps://avatars.githubusercontent.com/u/9087854?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/9087854?s=400&v=4
og:image:altThis was discussed in #131969 (cc @ZeroIntensity), but deferred to get the smaller change in. This PR adds all of the core interpreter types currently exposed in the types module to _typesmodule.c....
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb23b8fcc855cd29bb04d6c94aafa62d336bf44eefa8229444eecc968cad03aee
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
release0672399d88424758731ec07fe24509e23bb17fb5
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/132103/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F132103%2Ffiles
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%2F132103%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/132103/files
Reloadhttps://github.com/python/cpython/pull/132103/files
Reloadhttps://github.com/python/cpython/pull/132103/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/132103/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k 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 Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/pull/132103/files
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
AA-Turnerhttps://github.com/AA-Turner
python:mainhttps://github.com/python/cpython/tree/main
AA-Turner:more-_typeshttps://github.com/AA-Turner/cpython/tree/more-_types
Conversation 30 https://github.com/python/cpython/pull/132103
Commits 10 https://github.com/python/cpython/pull/132103/commits
Checks 43 https://github.com/python/cpython/pull/132103/checks
Files changed 3 https://github.com/python/cpython/pull/132103/files
GH-118761: Expose more core interpreter types in _types https://github.com/python/cpython/pull/132103/files#top
Show all changes 10 commits https://github.com/python/cpython/pull/132103/files
737216d Expose more core types in ``_types`` AA-Turner Apr 4, 2025 https://github.com/python/cpython/pull/132103/commits/737216d2b73ae681e0cda305ec5a7233a9e03150
0c3c8be Use a macro AA-Turner Apr 5, 2025 https://github.com/python/cpython/pull/132103/commits/0c3c8be4ef062070cdf0557e0db76259667b2ae8
51cd97b Test that types are identical AA-Turner Apr 5, 2025 https://github.com/python/cpython/pull/132103/commits/51cd97b7a6c1b6fd5dbd736dcd69f8554bbdc256
84c2285 fix typo AA-Turner Apr 5, 2025 https://github.com/python/cpython/pull/132103/commits/84c2285941377482496963a79b0b25620f66c819
fd19ac6 Align comments AA-Turner Apr 5, 2025 https://github.com/python/cpython/pull/132103/commits/fd19ac662e2f6dd8a634ff3042337622a53ebcf9
74aac08 Ensure EXPORT_STATIC_TYPE is used with static types AA-Turner Apr 5, 2025 https://github.com/python/cpython/pull/132103/commits/74aac08440c1458666bb594fcfa42d1c2a98e935
0fbbf0e Update comments AA-Turner Apr 5, 2025 https://github.com/python/cpython/pull/132103/commits/0fbbf0ec14d0925d2281f05d47882223acf1742b
3dd8e04 Tweak `test_names()` AA-Turner Apr 5, 2025 https://github.com/python/cpython/pull/132103/commits/3dd8e04d376ba0a57486bf937d8772624c134229
de81f97 style AA-Turner Apr 5, 2025 https://github.com/python/cpython/pull/132103/commits/de81f9719aa11b15c77f6b3b9c178a5495bedd1c
816d2bc whitespace AA-Turner Apr 5, 2025 https://github.com/python/cpython/pull/132103/commits/816d2bc2082e87bf1030d5201ac4d289096c2ecf
Clear filters https://github.com/python/cpython/pull/132103/files
Please reload this pagehttps://github.com/python/cpython/pull/132103/files
Please reload this pagehttps://github.com/python/cpython/pull/132103/files
test_types.py https://github.com/python/cpython/pull/132103/files#diff-d5154ccf7a97612e4a8b06a6f0f48f15554e426e72e698f246d17d3dd8e3a75a
types.py https://github.com/python/cpython/pull/132103/files#diff-14c8ad728bd63143566c2c1e5a85a7b20cebc910278ac9202978e845dc63f215
_typesmodule.c https://github.com/python/cpython/pull/132103/files#diff-c9dd8a7ac54955f731463f301f5e132de7b24be6adf9fa209ee3c84a5627f84b
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L605
Lib/test/test_types.pyhttps://github.com/python/cpython/pull/132103/files#diff-d5154ccf7a97612e4a8b06a6f0f48f15554e426e72e698f246d17d3dd8e3a75a
View file https://github.com/AA-Turner/cpython/blob/816d2bc2082e87bf1030d5201ac4d289096c2ecf/Lib/test/test_types.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/132103/{{ revealButtonHref }}
https://github.com/python/cpython/pull/132103/files#diff-d5154ccf7a97612e4a8b06a6f0f48f15554e426e72e698f246d17d3dd8e3a75a
https://github.com/python/cpython/pull/132103/files#diff-d5154ccf7a97612e4a8b06a6f0f48f15554e426e72e698f246d17d3dd8e3a75a
https://github.com/python/cpython/pull/132103/files#diff-d5154ccf7a97612e4a8b06a6f0f48f15554e426e72e698f246d17d3dd8e3a75a
Please reload this pagehttps://github.com/python/cpython/pull/132103/files
https://github.com/python/cpython/pull/132103/files#diff-d5154ccf7a97612e4a8b06a6f0f48f15554e426e72e698f246d17d3dd8e3a75a
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L606
Lib/types.pyhttps://github.com/python/cpython/pull/132103/files#diff-14c8ad728bd63143566c2c1e5a85a7b20cebc910278ac9202978e845dc63f215
View file https://github.com/AA-Turner/cpython/blob/816d2bc2082e87bf1030d5201ac4d289096c2ecf/Lib/types.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/132103/{{ revealButtonHref }}
https://github.com/python/cpython/pull/132103/files#diff-14c8ad728bd63143566c2c1e5a85a7b20cebc910278ac9202978e845dc63f215
Please reload this pagehttps://github.com/python/cpython/pull/132103/files
Please reload this pagehttps://github.com/python/cpython/pull/132103/files
https://github.com/python/cpython/pull/132103/files#diff-14c8ad728bd63143566c2c1e5a85a7b20cebc910278ac9202978e845dc63f215
https://github.com/python/cpython/pull/132103/files#diff-14c8ad728bd63143566c2c1e5a85a7b20cebc910278ac9202978e845dc63f215
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L607
Modules/_typesmodule.chttps://github.com/python/cpython/pull/132103/files#diff-c9dd8a7ac54955f731463f301f5e132de7b24be6adf9fa209ee3c84a5627f84b
View file https://github.com/AA-Turner/cpython/blob/816d2bc2082e87bf1030d5201ac4d289096c2ecf/Modules/_typesmodule.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/132103/{{ revealButtonHref }}
Please reload this pagehttps://github.com/python/cpython/pull/132103/files
https://github.com/python/cpython/pull/132103/files#diff-c9dd8a7ac54955f731463f301f5e132de7b24be6adf9fa209ee3c84a5627f84b
Please reload this pagehttps://github.com/python/cpython/pull/132103/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.