René's URL Explorer Experiment


Title: [C API] Revert of private functions removed in Python 3.13 causing most problems · Issue #112026 · python/cpython · GitHub

Open Graph Title: [C API] Revert of private functions removed in Python 3.13 causing most problems · Issue #112026 · python/cpython

X Title: [C API] Revert of private functions removed in Python 3.13 causing most problems · Issue #112026 · python/cpython

Description: Copy of my Discourse message. Hi, My C API: My plan to clarify private vs public functions in Python 3.13 uses Python 3.13 beta 1 (May 2024) as deadline to make most C extensions compatible with Python 3.13. Problem: I wasn't prepared fo...

Open Graph Description: Copy of my Discourse message. Hi, My C API: My plan to clarify private vs public functions in Python 3.13 uses Python 3.13 beta 1 (May 2024) as deadline to make most C extensions compatible with Py...

X Description: Copy of my Discourse message. Hi, My C API: My plan to clarify private vs public functions in Python 3.13 uses Python 3.13 beta 1 (May 2024) as deadline to make most C extensions compatible with Py...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[C API] Revert of private functions removed in Python 3.13 causing most problems","articleBody":"Copy of my [Discourse message](https://discuss.python.org/t/revert-python-3-13-c-api-incompatible-changes-causing-most-troubles/38214).\r\n\r\nHi,\r\n\r\nMy [C API: My plan to clarify private vs public functions in Python 3.13](https://discuss.python.org/t/c-api-my-plan-to-clarify-private-vs-public-functions-in-python-3-13/30131) uses Python 3.13 beta 1 (May 2024) as deadline to make most C extensions compatible with Python 3.13.\r\n\r\nProblem: **I wasn't prepared for the number of people eagger to test their project on Python 3.13 alpha 1 as soon as it was released.** Some people are working on porting their own code to Python 3.13, whereas others are blocked by dependencies not compatible yet. **For Python 3.12, it took months** to get Cython (7 months) and numpy (10 months) to become compatible (with a release), and apparently people were fine with this pace. I expected to have 6 months to go through issues and make decisions on a case by case basis. But Cython was made compatible with Python 3.13 (alpha1) in 1 week! Well, for the Cython case, becoming compatible mostly means \"disable optimizations\" sadly. I don't want Cython (or other projects) to become slower.\r\n\r\nOverall, it's great that people test Python 3.13 alpha 1! I love that, getting feedback as soon as possible! I want to encourage that and help people who are going through issue.\r\n\r\nI'm still bug triaging C API reports, whereas some people ask to get Python 3.13 being fixed \"right now\". My plan is about designing public C API to replace removed privated functions, but this work takes time since we want to design \"future proof\" API which cover most use cases, expose less implementation details, and following the [latest C API guidelines](https://devguide.python.org/developer-workflow/c-api/index.html). It's not just \"take the private API and put it in the public C API\": even if new public functions are added, they will not be drop-in replacements (there might be more work than \"remove the underscore prefix\").\r\n\r\nI tried to communicate as much as I can in advance about my plan removing private C functions. **Now that the changes are done, the impact is known better, and we should reevaluate the situation with these new information.**\r\n\r\nAnother problem is that it's unclear to me how C API decisions are taken. Latest C API questions to the Steering Council were delegated to the future C API Working Group, but the [Working Group doesn't exist yet](https://github.com/python/steering-council/issues/210).\r\n\r\n---\r\n\r\nSo well, let me propose concrete actions.\r\n\r\nWhat should be done right now:\r\n\r\n* **Revert** immediately C API changes impacting at least 5 projects. My colleague Karolina did a [great bug triage work on couting build failures per C API issue](https://discuss.python.org/t/ongoing-packages-rebuild-with-python-3-13-in-fedora/38134) by recompiling 4000+ Python packages in Fedora with Python 3.13.\r\n* Consider reverting more changes on a case by case basis.\r\n\r\nWhat should be done next:\r\n\r\n* For removed functions which impact at least one project but we decide to not revert, document a solution in What's New in Python 3.13 (even if the function was \"private\", usually we don't document changes related to private APIs). I expected the existing public C API to be complete enough, but the devil is in the details, and \"it's complicated\". Some functions are only available in the private/internal C API, there is \"no good\" replacement in the public C API. Well, that's the part that I'm trying to fix.\r\n* Add better public C API function to replace private C API functions.\r\n* Help projects to migrate to better public C API functions.\r\n\r\nWhat can be done in the long term:\r\n\r\n* Clarify what ``_Py`` prefix means: does it mean \"can be changed anytime, no backward compatibility\"? Or does mean \"it depends...\"?\r\n* Design a new approach to introduce incompatible C API changes. IMO the most practical one would be to introduce the concept of a \"compatibility version\" and let C extensions opt-in for \"future\" incompatible changes. It may give more control on who is impacted and when. For example, you can target the \"C API version 3.15\" and you will be impacted by all planned changes, especially deprecated functions scheduled for removal.\r\n* Design guidelines on how to introduce incompatible changes.\r\n\r\n---\r\n\r\nThe overall plan on private APIs was done in the frame of the [private API contract](https://docs.python.org/dev/c-api/stable.html):\r\n\r\n\u003e Names prefixed by an underscore, such as _Py_InternalState, are private API that **can change without notice** even in patch releases.\r\n\r\nWell. That's the theory, and the practice shows me that users have \"different expectations\". Apparently, we have to update/complete this contract...\r\n\r\n---\r\n\r\nIf we revert private C API function removals, does it mean that these **private** functions become part of the **public** C API and have to stay forever, be documented and tested? Or would they move back to their previous state: not supported and \"can change anything (which includes being removed)\"?\r\n\r\n---\r\n\r\nSee also:\r\n\r\n* [Is Python 3.13 going to be Python 4?](https://discuss.python.org/t/is-python-3-13-going-to-be-python-4/37490) discussion\r\n* [C API: Meta issue to replace removed functions with new clean public functions](https://github.com/python/cpython/issues/111481)\r\n* [C API: Remove private C API functions (move them to the internal C API)](https://github.com/python/cpython/issues/106320#issuecomment-1762776276): link to recent discussions in this issue. I asked people to create new issues, since this one history is too long, but people prefer to commenting this issues instead.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-112046\n* gh-112115\n* gh-112119\n* gh-112121\n* gh-112171\n* gh-119855\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2023-11-13T11:00:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/112026/cpython/issues/112026"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8801be20-5ae4-8f80-c622-ea9df160f291
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDDF8:1219C5:6EFEB:9C841:696A0C50
html-safe-nonce8fac30c3dfe43db7ddc07d912b249b25ac81ee408e422d0551f936b63132e36b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEREY4OjEyMTlDNTo2RUZFQjo5Qzg0MTo2OTZBMEM1MCIsInZpc2l0b3JfaWQiOiIxNTkxMDA4NzgwNDUyNzYwNjU2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac1ef554f756fe328dfefbee08a64268a088b250d52414b14f82721e4d4c429742
hovercard-subject-tagissue:1990412474
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/112026/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d5a68266fed77c7c3827055cea899d0b5591188a5d24a287859d09828732ccd2/python/cpython/issues/112026
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d5a68266fed77c7c3827055cea899d0b5591188a5d24a287859d09828732ccd2/python/cpython/issues/112026
og:image:altCopy of my Discourse message. Hi, My C API: My plan to clarify private vs public functions in Python 3.13 uses Python 3.13 beta 1 (May 2024) as deadline to make most C extensions compatible with Py...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevstinner
hostnamegithub.com
expected-hostnamegithub.com
None699227a00bbb7fe1eec276d2ae1c3a93068bc5ba483bd9dc4b2a27a8f4f2f595
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
release7266b2d935baa1c6474b16dd9feaa5ca30607261
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/112026#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F112026
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%2F112026
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/112026
Reloadhttps://github.com/python/cpython/issues/112026
Reloadhttps://github.com/python/cpython/issues/112026
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/112026
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/112026
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/112026
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/112026
[C API] Revert of private functions removed in Python 3.13 causing most problemshttps://github.com/python/cpython/issues/112026#top
topic-C-APIhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-C-API%22
https://github.com/vstinner
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Nov 13, 2023https://github.com/python/cpython/issues/112026#issue-1990412474
Discourse messagehttps://discuss.python.org/t/revert-python-3-13-c-api-incompatible-changes-causing-most-troubles/38214
C API: My plan to clarify private vs public functions in Python 3.13https://discuss.python.org/t/c-api-my-plan-to-clarify-private-vs-public-functions-in-python-3-13/30131
latest C API guidelineshttps://devguide.python.org/developer-workflow/c-api/index.html
Working Group doesn't exist yethttps://github.com/python/steering-council/issues/210
great bug triage work on couting build failures per C API issuehttps://discuss.python.org/t/ongoing-packages-rebuild-with-python-3-13-in-fedora/38134
private API contracthttps://docs.python.org/dev/c-api/stable.html
Is Python 3.13 going to be Python 4?https://discuss.python.org/t/is-python-3-13-going-to-be-python-4/37490
C API: Meta issue to replace removed functions with new clean public functionshttps://github.com/python/cpython/issues/111481
C API: Remove private C API functions (move them to the internal C API)https://github.com/python/cpython/issues/106320#issuecomment-1762776276
gh-112026: Add again include in Python.h #112046https://github.com/python/cpython/pull/112046
gh-112026: Restore removed private C API #112115https://github.com/python/cpython/pull/112115
gh-112026: Restore removed _PyDict_GetItemStringWithError() #112119https://github.com/python/cpython/pull/112119
gh-112026: Add again _PyThreadState_UncheckedGet() function #112121https://github.com/python/cpython/pull/112121
gh-112026: Update What's New: _PyObject_Vectorcall() was restored #112171https://github.com/python/cpython/pull/112171
gh-112026: Deprecate _PyDict_GetItemStringWithError() function #119855https://github.com/python/cpython/pull/119855
topic-C-APIhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-C-API%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.