René's URL Explorer Experiment


Title: gh-111506: Add _Py_OPAQUE_PYOBJECT to hide PyObject layout & related API by encukou · Pull Request #136505 · python/cpython · GitHub

Open Graph Title: gh-111506: Add _Py_OPAQUE_PYOBJECT to hide PyObject layout & related API by encukou · Pull Request #136505 · python/cpython

X Title: gh-111506: Add _Py_OPAQUE_PYOBJECT to hide PyObject layout & related API by encukou · Pull Request #136505 · python/cpython

Description: Make it so that defining _Py_OPAQUE_PYOBJECT before including will make the PyObject struct opaque, and hide all limited-API structs & functions that need access to it. Also, allow Py_LIMITED_API with Py_GIL_DISABLED if _Py_OPAQUE_PYOBJECT is defined. Opaque PyObject will be needed for most alternatives we have of defining a Stable ABI for free-threaded builds. See Discourse thread for discussion. (We may want to either expose this to users as Py_OPAQUE_PYOBJECT, or define it implicitly for limited-API free-threaded builds.) And if I'm wrong -- this is easy to remove, like like Py_GIL_DISABLED. As I mentioned, I'd like to put this in main to avoid rebasing a fork and to make it easier to build on top. Issue: gh-111506

Open Graph Description: Make it so that defining _Py_OPAQUE_PYOBJECT before including <Python.h> will make the PyObject struct opaque, and hide all limited-API structs & functions that need access to it. Also, a...

X Description: Make it so that defining _Py_OPAQUE_PYOBJECT before including &lt;Python.h&gt; will make the PyObject struct opaque, and hide all limited-API structs &amp; functions that need access to...

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

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:513131ae-caad-d717-4a71-ddd3669daa29
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idEA4E:3DD488:3E6A6C6:4F4DF18:6B0217E4
html-safe-noncee0194611341feb3afb62b93a0507f4dc4c6dd2d0d2978126e5455b9b5a575936
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTRFOjNERDQ4ODozRTZBNkM2OjRGNERGMTg6NkIwMjE3RTQiLCJ2aXNpdG9yX2lkIjoiNDI5MTE0NzcyMzI0OTQyNDM1NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac3105bff35c31d6f775e3a58abfa201de6ddf70a043936282c1238590356e5c5d
hovercard-subject-tagpull_request:2655676877
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/136505/files
twitter:imagehttps://avatars.githubusercontent.com/u/302922?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/302922?s=400&v=4
og:image:altMake it so that defining _Py_OPAQUE_PYOBJECT before including <Python.h> will make the PyObject struct opaque, and hide all limited-API structs & functions that need access to it. Also, a...
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/136505/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F136505%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%2F136505%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/136505/files
Reloadhttps://github.com/python/cpython/pull/136505/files
Reloadhttps://github.com/python/cpython/pull/136505/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
encukouhttps://github.com/encukou
python:mainhttps://github.com/python/cpython/tree/main
encukou:opaque-pyobject-privhttps://github.com/encukou/cpython/tree/opaque-pyobject-priv
Conversation 7 https://github.com/python/cpython/pull/136505
Commits 5 https://github.com/python/cpython/pull/136505/commits
Checks 0 https://github.com/python/cpython/pull/136505/checks
Files changed https://github.com/python/cpython/pull/136505/files
Please reload this pagehttps://github.com/python/cpython/pull/136505/files
gh-111506: Add _Py_OPAQUE_PYOBJECT to hide PyObject layout & related API https://github.com/python/cpython/pull/136505/files#top
Show all changes 5 commits https://github.com/python/cpython/pull/136505/files
2639997 Allow Py_LIMITED_API for (Py_GIL_DISABLED && _Py_OPAQUE_PYOBJECT) encukou Jun 24, 2025 https://github.com/python/cpython/pull/136505/commits/2639997fa2afeee66635de366dad31937830634d
7ff56f4 Hide some API if _Py_OPAQUE_PYOBJECT is defined encukou Jul 8, 2025 https://github.com/python/cpython/pull/136505/commits/7ff56f41d91457ac1baa1ce72312d8d7ce61acb7
33d9ae7 Add test for _Py_OPAQUE_PYOBJECT encukou May 26, 2025 https://github.com/python/cpython/pull/136505/commits/33d9ae7cbeea2702baa8566617d48d855e0242f7
781e2ab Apply suggestions from code review vstinner Jul 11, 2025 https://github.com/python/cpython/pull/136505/commits/781e2abecd12aa092f48ca34ea5290fb7764d23f
08d963d Merge in the main branch to solve conflict encukou Jul 11, 2025 https://github.com/python/cpython/pull/136505/commits/08d963d8a328191ea7428ae90273fab7f6166fc1
Clear filters https://github.com/python/cpython/pull/136505/files
Please reload this pagehttps://github.com/python/cpython/pull/136505/files
Please reload this pagehttps://github.com/python/cpython/pull/136505/files
Python.h https://github.com/python/cpython/pull/136505/files#diff-f60ef9db994347493c9ad11a939d46272a5b9a3d03e9aa22f186a87dd9ce8769
moduleobject.h https://github.com/python/cpython/pull/136505/files#diff-b922950b4d9070569144f21cce5616a05ef2b86415c05e965f10acfbe8652d9f
object.h https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
refcount.h https://github.com/python/cpython/pull/136505/files#diff-586c6481df97b64cf94363854b92d8e896f8b969f9f160fdb69ba0eae3cdc987
__init__.py https://github.com/python/cpython/pull/136505/files#diff-0ab884195ba524e4b7afc42bc851ca375bf0d1e1b7f105d3b7f7127524f84009
create_moduledef.c https://github.com/python/cpython/pull/136505/files#diff-10b1d3dc55461240495d81b43759c0e10a19a0058c01ae832517cef32adae4b5
extension.c https://github.com/python/cpython/pull/136505/files#diff-02265e113c37de1cbaefe6ff43542737edbb93834ceae1a8fdd030e9882a41c0
setup.py https://github.com/python/cpython/pull/136505/files#diff-59682024360a2b05305c3501fe3c1fc17d715e2a3acd0f61a6c9aa1ebdd60e52
Include/Python.hhttps://github.com/python/cpython/pull/136505/files#diff-f60ef9db994347493c9ad11a939d46272a5b9a3d03e9aa22f186a87dd9ce8769
View file https://github.com/encukou/cpython/blob/08d963d8a328191ea7428ae90273fab7f6166fc1/Include/Python.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/136505/{{ revealButtonHref }}
https://github.com/python/cpython/pull/136505/files#diff-f60ef9db994347493c9ad11a939d46272a5b9a3d03e9aa22f186a87dd9ce8769
https://github.com/python/cpython/pull/136505/files#diff-f60ef9db994347493c9ad11a939d46272a5b9a3d03e9aa22f186a87dd9ce8769
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L267
Include/moduleobject.hhttps://github.com/python/cpython/pull/136505/files#diff-b922950b4d9070569144f21cce5616a05ef2b86415c05e965f10acfbe8652d9f
View file https://github.com/encukou/cpython/blob/08d963d8a328191ea7428ae90273fab7f6166fc1/Include/moduleobject.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/136505/{{ revealButtonHref }}
https://github.com/python/cpython/pull/136505/files#diff-b922950b4d9070569144f21cce5616a05ef2b86415c05e965f10acfbe8652d9f
https://github.com/python/cpython/pull/136505/files#diff-b922950b4d9070569144f21cce5616a05ef2b86415c05e965f10acfbe8652d9f
https://github.com/python/cpython/pull/136505/files#diff-b922950b4d9070569144f21cce5616a05ef2b86415c05e965f10acfbe8652d9f
https://github.com/python/cpython/pull/136505/files#diff-b922950b4d9070569144f21cce5616a05ef2b86415c05e965f10acfbe8652d9f
https://github.com/python/cpython/pull/136505/files#diff-b922950b4d9070569144f21cce5616a05ef2b86415c05e965f10acfbe8652d9f
https://github.com/python/cpython/pull/136505/files#diff-b922950b4d9070569144f21cce5616a05ef2b86415c05e965f10acfbe8652d9f
https://github.com/python/cpython/pull/136505/files#diff-b922950b4d9070569144f21cce5616a05ef2b86415c05e965f10acfbe8652d9f
Include/object.hhttps://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
View file https://github.com/encukou/cpython/blob/08d963d8a328191ea7428ae90273fab7f6166fc1/Include/object.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/136505/{{ revealButtonHref }}
https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/136505/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
Include/refcount.hhttps://github.com/python/cpython/pull/136505/files#diff-586c6481df97b64cf94363854b92d8e896f8b969f9f160fdb69ba0eae3cdc987
View file https://github.com/encukou/cpython/blob/08d963d8a328191ea7428ae90273fab7f6166fc1/Include/refcount.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/136505/{{ revealButtonHref }}
https://github.com/python/cpython/pull/136505/files#diff-586c6481df97b64cf94363854b92d8e896f8b969f9f160fdb69ba0eae3cdc987
https://github.com/python/cpython/pull/136505/files#diff-586c6481df97b64cf94363854b92d8e896f8b969f9f160fdb69ba0eae3cdc987
https://github.com/python/cpython/pull/136505/files#diff-586c6481df97b64cf94363854b92d8e896f8b969f9f160fdb69ba0eae3cdc987
Lib/test/test_cext/__init__.pyhttps://github.com/python/cpython/pull/136505/files#diff-0ab884195ba524e4b7afc42bc851ca375bf0d1e1b7f105d3b7f7127524f84009
View file https://github.com/encukou/cpython/blob/08d963d8a328191ea7428ae90273fab7f6166fc1/Lib/test/test_cext/__init__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/136505/{{ revealButtonHref }}
https://github.com/python/cpython/pull/136505/files#diff-0ab884195ba524e4b7afc42bc851ca375bf0d1e1b7f105d3b7f7127524f84009
https://github.com/python/cpython/pull/136505/files#diff-0ab884195ba524e4b7afc42bc851ca375bf0d1e1b7f105d3b7f7127524f84009
https://github.com/python/cpython/pull/136505/files#diff-0ab884195ba524e4b7afc42bc851ca375bf0d1e1b7f105d3b7f7127524f84009
https://github.com/python/cpython/pull/136505/files#diff-0ab884195ba524e4b7afc42bc851ca375bf0d1e1b7f105d3b7f7127524f84009
https://github.com/python/cpython/pull/136505/files#diff-0ab884195ba524e4b7afc42bc851ca375bf0d1e1b7f105d3b7f7127524f84009
Lib/test/test_cext/create_moduledef.chttps://github.com/python/cpython/pull/136505/files#diff-10b1d3dc55461240495d81b43759c0e10a19a0058c01ae832517cef32adae4b5
View file https://github.com/encukou/cpython/blob/08d963d8a328191ea7428ae90273fab7f6166fc1/Lib/test/test_cext/create_moduledef.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/136505/{{ revealButtonHref }}
Lib/test/test_cext/extension.chttps://github.com/python/cpython/pull/136505/files#diff-02265e113c37de1cbaefe6ff43542737edbb93834ceae1a8fdd030e9882a41c0
View file https://github.com/encukou/cpython/blob/08d963d8a328191ea7428ae90273fab7f6166fc1/Lib/test/test_cext/extension.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/136505/{{ revealButtonHref }}
https://github.com/python/cpython/pull/136505/files#diff-02265e113c37de1cbaefe6ff43542737edbb93834ceae1a8fdd030e9882a41c0
https://github.com/python/cpython/pull/136505/files#diff-02265e113c37de1cbaefe6ff43542737edbb93834ceae1a8fdd030e9882a41c0
https://github.com/python/cpython/pull/136505/files#diff-02265e113c37de1cbaefe6ff43542737edbb93834ceae1a8fdd030e9882a41c0
Lib/test/test_cext/setup.pyhttps://github.com/python/cpython/pull/136505/files#diff-59682024360a2b05305c3501fe3c1fc17d715e2a3acd0f61a6c9aa1ebdd60e52
View file https://github.com/encukou/cpython/blob/08d963d8a328191ea7428ae90273fab7f6166fc1/Lib/test/test_cext/setup.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/136505/{{ revealButtonHref }}
https://github.com/python/cpython/pull/136505/files#diff-59682024360a2b05305c3501fe3c1fc17d715e2a3acd0f61a6c9aa1ebdd60e52
https://github.com/python/cpython/pull/136505/files#diff-59682024360a2b05305c3501fe3c1fc17d715e2a3acd0f61a6c9aa1ebdd60e52
https://github.com/python/cpython/pull/136505/files#diff-59682024360a2b05305c3501fe3c1fc17d715e2a3acd0f61a6c9aa1ebdd60e52
https://github.com/python/cpython/pull/136505/files#diff-59682024360a2b05305c3501fe3c1fc17d715e2a3acd0f61a6c9aa1ebdd60e52
https://github.com/python/cpython/pull/136505/files#diff-59682024360a2b05305c3501fe3c1fc17d715e2a3acd0f61a6c9aa1ebdd60e52
https://github.com/python/cpython/pull/136505/files#diff-59682024360a2b05305c3501fe3c1fc17d715e2a3acd0f61a6c9aa1ebdd60e52
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.