Title: Deprecate private C API functions · Issue #141049 · python/cpython · GitHub
Open Graph Title: Deprecate private C API functions · Issue #141049 · python/cpython
X Title: Deprecate private C API functions · Issue #141049 · python/cpython
Description: I propose to deprecate 42 private functions of the C API: _PyArg_ParseTupleAndKeywordsFast(): see #112136 _PyCode_CheckLineNumber() _PyDict_GetItem_KnownHash() _PyDict_NewPresized(): see #139772 _PyErr_ChainExceptions1(): see #116809 _Py...
Open Graph Description: I propose to deprecate 42 private functions of the C API: _PyArg_ParseTupleAndKeywordsFast(): see #112136 _PyCode_CheckLineNumber() _PyDict_GetItem_KnownHash() _PyDict_NewPresized(): see #139772 _P...
X Description: I propose to deprecate 42 private functions of the C API: _PyArg_ParseTupleAndKeywordsFast(): see #112136 _PyCode_CheckLineNumber() _PyDict_GetItem_KnownHash() _PyDict_NewPresized(): see #139772 _P...
Opengraph URL: https://github.com/python/cpython/issues/141049
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deprecate private C API functions","articleBody":"I propose to deprecate 42 private functions of the C API:\n\n* ``_PyArg_ParseTupleAndKeywordsFast()``: see https://github.com/python/cpython/issues/112136\n* ``_PyCode_CheckLineNumber()``\n* ``_PyDict_GetItem_KnownHash()``\n* ``_PyDict_NewPresized()``: see https://github.com/python/cpython/issues/139772\n* ``_PyErr_ChainExceptions1()``: see https://github.com/python/cpython/issues/116809\n* ``_PyEval_SliceIndex()``\n* ``_PyEval_SliceIndexNotNone()``\n* ``_PyFrame_IsEntryFrame()``\n* ``_PyInterpreterState_GetEvalFrameFunc()``, ``_PyInterpreterState_SetEvalFrameFunc()``, ``_PyEval_EvalFrameDefault()``: PEP 523, see https://github.com/python/cpython/issues/141518\n* ``_PyInterpreterState_RequireIDRef()``\n* ``_PyInterpreterState_RequiresIDRef()``\n* ``_PyLong_AsByteArray()``: use ``PyLong_AsNativeBytes()``\n* ``_PyLong_Copy()``\n* ``_PyLong_FromByteArray()``: use ``PyLong_FromNativeBytes()``\n* ``_PyLong_GCD()``: call Python ``math.gcd()`` function\n* ``_PyLong_NumBits()``: call Python ``int.bit_length()`` method\n* ``_PyObject_CallMethodId()``: use ``PyObject_CallMethod()``\n* ``_PyObject_Dump()``: see https://github.com/python/cpython/issues/141070\n* ``_PyObject_FunctionStr()``\n* ``_PyObject_GetAttrId()``: use ``PyObject_GetAttr()``\n* ``_PyObject_GetDictPtr()``: see https://github.com/python/cpython/issues/139852\n* ``_PySlice_FromIndices()``: use ``PySlice_New()``\n* ``_PySlice_GetLongIndices()``\n* ``_PyStack_AsDict()``\n* ``_PyThread_CurrentFrames()``: call Python ``sys._current_frames()`` function\n* ``_PyType_Lookup()``, ``_PyType_LookupRef()``: see https://github.com/python/cpython/issues/139847\n* ``_PyType_Name()``: use ``PyType_GetName()``\n* ``_PyUnicode_FromId()``: use ``PyUnicode_FromString()`` and cache the result; see the old [discussion](https://discuss.python.org/t/c-api-how-much-private-is-the-private-py-identifier-api/29190) (2023)\n* ``_PyWeakref_ClearRef()``\n* ``_Py_BreakPoint()``\n* ``_Py_GetGlobalRefTotal()``, ``_Py_GetLegacyRefTotal()``, ``_PyInterpreterState_GetRefTotal()``: call Python ``sys.gettotalrefcount()`` function\n* ``_Py_HashDouble()``: see [decision issue #2](https://github.com/capi-workgroup/decisions/issues/2) and [decision issue #10](https://github.com/capi-workgroup/decisions/issues/10)\n* ``_Py_NewReference()``, ``_Py_NewReferenceNoTotal()``, ``_Py_ForgetReference()``, ``_Py_ResurrectReference()``: see [old issue](https://github.com/python/cpython/issues/85161) \n* ~``_Py_ReachedRecursionLimitWithMargin()``~: see https://github.com/python/cpython/pull/141951\n\nIf one of these functions is used, users should request a public C API replacing the private function.\n\nI propose to **not schedule the removal** of these functions for now.","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2025-11-05T15:10:00Z","url":"https://github.com/python/cpython/issues/141049"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:028a3a22-bc79-8e68-a73c-68aa7dd7f13d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DCEA:34CAB:34CD42D:4389C37:6B01EE11 |
| html-safe-nonce | aaa457b7e4e37b7d610c9337747307217773439fbf1b808788c67df071c5f5a9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQ0VBOjM0Q0FCOjM0Q0Q0MkQ6NDM4OUMzNzo2QjAxRUUxMSIsInZpc2l0b3JfaWQiOiIzNzA4NTI4MDU1NTQwNzMxMDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fce405c7fe4d6a13870e2300ad7f2f6942ac642c49b424f33d5b02a82bdb5d7a |
| hovercard-subject-tag | issue:3591542612 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/141049/issue_layout |
| twitter:image | https://opengraph.githubassets.com/36bd27c65b0a36607b7a767fb7dec079b281bd216a0e61ee2fd192cfa85c374c/python/cpython/issues/141049 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/36bd27c65b0a36607b7a767fb7dec079b281bd216a0e61ee2fd192cfa85c374c/python/cpython/issues/141049 |
| og:image:alt | I propose to deprecate 42 private functions of the C API: _PyArg_ParseTupleAndKeywordsFast(): see #112136 _PyCode_CheckLineNumber() _PyDict_GetItem_KnownHash() _PyDict_NewPresized(): see #139772 _P... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vstinner |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width