René's URL Explorer Experiment


Title: C API: Investigate how the PyTypeObject members can be removed from the public C API · Issue #105970 · python/cpython · GitHub

Open Graph Title: C API: Investigate how the PyTypeObject members can be removed from the public C API · Issue #105970 · python/cpython

X Title: C API: Investigate how the PyTypeObject members can be removed from the public C API · Issue #105970 · python/cpython

Description: I propose to investigate an incompatible C API change: make the PyTypeObject and PyHeapTypeObject structures opaque, remove their members from the public C API (move them to the internal C API). We have to investigate how it's outside in...

Open Graph Description: I propose to investigate an incompatible C API change: make the PyTypeObject and PyHeapTypeObject structures opaque, remove their members from the public C API (move them to the internal C API). We...

X Description: I propose to investigate an incompatible C API change: make the PyTypeObject and PyHeapTypeObject structures opaque, remove their members from the public C API (move them to the internal C API). We...

Opengraph URL: https://github.com/python/cpython/issues/105970

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"C API: Investigate how the PyTypeObject members can be removed from the public C API","articleBody":"I propose to investigate an incompatible C API change: make the ``PyTypeObject`` and ``PyHeapTypeObject`` structures opaque, remove their members from the public C API (move them to the internal C API). We have to investigate how it's outside in 3rd party C extensions (ex: Cython, pybind11, etc.), and design a smooth migration plan.\r\n\r\nThe PyTypeObject structure is exposed as part of the public Python C API. For example, ``Py_TYPE(obj)-\u003etp_name`` directly gets a type name (as a UTF-8 encoded byte string, ``char*``).\r\n\r\nThe PyTypeObject members are **NOT** part of the limited C API (PEP 384).\r\n\r\n---\r\n\r\nIn Python 3.9 (2020), I reworked the C API to avoid accessing directly PyTypeObject members at the ABI level: issue #84351. For example, Python 3.8 implements ``PyObject_IS_GC()`` as a macro:\r\n\r\n```c\r\n/* Test if an object has a GC head */\r\n#define PyObject_IS_GC(o) \\\r\n    (PyType_IS_GC(Py_TYPE(o)) \\\r\n     \u0026\u0026 (Py_TYPE(o)-\u003etp_is_gc == NULL || Py_TYPE(o)-\u003etp_is_gc(o)))\r\n```\r\n\r\nwhereas Python 3.9 only provides an opaque function call:\r\n\r\n```c\r\n/* Test if an object implements the garbage collector protocol */\r\nPyAPI_FUNC(int) PyObject_IS_GC(PyObject *obj);\r\n```\r\n\r\nAt the ABI level, the direct access to the ``PyTypeObject.tp_is_gc`` member became an opaque function call.\r\n\r\n---\r\n\r\nChanging PyTypeObject API and ABI caused a lot of troubles in the past. Example:\r\n\r\n* issue GH-81431: Cython broken by ``PyTypeObject.tp_print`` removal -- related to ``PyTypeObject.tp_vectorcall_offset`` addition\r\n* issue GH-76569: ABI issue with the addition of ``PyTypeObject.tp_finalize`` (PEP 442). Is ``Py_TPFLAGS_HAVE_FINALIZE`` needed for ABI compatibility? See also the [python-dev thread](https://mail.python.org/pipermail/python-dev/2017-December/151345.html).\r\n* issue #86913: remove ``Py_TPFLAGS_HAVE_VERSION_TAG`` flag (ABI compatibility)\r\n* issue GH-91271: Documentation inconsistency with the stable ABI (PyTypeObject)\r\n* The [PEP 620](https://peps.python.org/pep-0620/#the-c-api-blocks-cpython-evolutions) uses PyTypeObject incompatible changes in its rationale.\r\n\r\n---\r\n\r\nFor many years, there is a work-in-progress to convert all Python built-in types and types of stdlib extensions from static types to heap types. See for example issue #84258 and [PEP 630](https://peps.python.org/pep-0630/).\r\n\r\nThe API and ABI for heap type was also enhanced over the years. Examples:\r\n\r\n* Python 3.12 adds ``PyType_FromMetaclass()``\r\n* Add the buffer protocol to the limited C API (to PyType_FromSpec()): issue #89622\r\n* issue GH-86201: get tp_name with PyType_GetSlot()\r\n\r\n---\r\n\r\nIn the past, other structure members were removed:\r\n\r\n* PyInterpreterState: Python 3.8\r\n* PyGC_Head: Python 3.9\r\n* PyFrameObject: Python 3.11\r\n\r\nThe work was also prepared for:\r\n\r\n* PyObject: issue #83754, Python 3.10 and Python 3.11, add Py_SET_REFCNT() and Py_SET_TYPE()\r\n* PyTheadState: issue #84128, Python 3.11","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2023-06-21T14:32:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/105970/cpython/issues/105970"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:ea756e3b-f7e6-d377-01fe-276de4573bad
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8910:C2480:995666:D5EBC8:696A794A
html-safe-noncecb72e0b2900957cfb57af7010ca48128cedef4712fc7f96809959808089cd4df
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTEwOkMyNDgwOjk5NTY2NjpENUVCQzg6Njk2QTc5NEEiLCJ2aXNpdG9yX2lkIjoiMjk2ODczNDQwMDk1NTE4NTQ4MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac20f904aff303e626ad0f16d1e684f2254ac529da99723fc930456a1a5659383c
hovercard-subject-tagissue:1767748969
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/105970/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5643349ccbe8cab1520dd1420f9d5d721fd6123e24f32214a2350f263df5c7ed/python/cpython/issues/105970
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5643349ccbe8cab1520dd1420f9d5d721fd6123e24f32214a2350f263df5c7ed/python/cpython/issues/105970
og:image:altI propose to investigate an incompatible C API change: make the PyTypeObject and PyHeapTypeObject structures opaque, remove their members from the public C API (move them to the internal C API). We...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevstinner
hostnamegithub.com
expected-hostnamegithub.com
None5b774e44f85c14a75886edd04ddda4e5a25ddebbb241bcbb590b08a3048730e8
turbo-cache-controlno-preview
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
releasecc5f4eee261b3601c1e98e217ceaf28508b9567e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/105970#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F105970
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%2Fissues%2F105970
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%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/105970
Reloadhttps://github.com/python/cpython/issues/105970
Reloadhttps://github.com/python/cpython/issues/105970
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/105970
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/issues/105970
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
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/105970
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/105970
C API: Investigate how the PyTypeObject members can be removed from the public C APIhttps://github.com/python/cpython/issues/105970#top
topic-C-APIhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-C-API%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/vstinner
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Jun 21, 2023https://github.com/python/cpython/issues/105970#issue-1767748969
#84351https://github.com/python/cpython/issues/84351
C files generated by Cython set tp_print to 0: PyTypeObject.tp_print removed #81431https://github.com/python/cpython/issues/81431
Remove cross-version binary compatibility #76569https://github.com/python/cpython/issues/76569
python-dev threadhttps://mail.python.org/pipermail/python-dev/2017-December/151345.html
Remove Py_TPFLAGS_HAVE_VERSION_TAG flag? #86913https://github.com/python/cpython/issues/86913
Documentation inconsistency with the stable ABI #91271https://github.com/python/cpython/issues/91271
PEP 620https://peps.python.org/pep-0620/#the-c-api-blocks-cpython-evolutions
#84258https://github.com/python/cpython/issues/84258
PEP 630https://peps.python.org/pep-0630/
Limited API support for Py_buffer #89622https://github.com/python/cpython/issues/89622
[C API] PyType_GetSlot cannot get tp_name #86201https://github.com/python/cpython/issues/86201
[C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type #83754https://github.com/python/cpython/issues/83754
[C API] Prepare the C API to make PyThreadState opaque: add getter functions #84128https://github.com/python/cpython/issues/84128
topic-C-APIhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-C-API%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
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.