GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — C API: Remove private C API functions (move them to the internal C API) · Issue #106320 · python/cpython

C API: Remove private C API functions (move them to the internal C API) #106320

New issue
Copy link
New issue
Copy link
Closed
Closed
C API: Remove private C API functions (move them to the internal C API)#106320
Copy link
Labels
topic-C-API

Description

@vstinner
vstinner
opened on Jul 1, 2023
Issue body actions

Over the years, we accumulated many private functions as part of the public C API header files. I propose to remove them: move them to the internal C API.

If many C extensions are affected by these removals, it's a sign that we should consider promoted used private functions as public functions: provide a better API, add error handling, write documentation, write tests.


Summary: My plan to clarify private vs public functions in Python 3.13

  • Private functions converted to public functions:

    • PyLong_AsInt(): issue [C API] Add PyLong_AsInt() public function #108444
    • Py_IsFinalizing(): PR gh-108014: Add Py_IsFinalizing() function #108032
  • Discussions:

    • (pssst) Let’s treat all API in public headers as public
    • list of PyPI affected projects
    • C API: How much private is the private _Py_IDENTIFIER() API? -- _Py_Identifier
    • _Py_c_xxx complex functions (ex: _Py_c_abs())
    • PR gh-107137: Add _PyTupleBuilder API to the internal C API #107139: Add _PyTupleBuilder API to the internal C API
  • Notes:

    • While being private, _PyBytes_Resize() and _PyTuple_Resize() are documented
    • The private _PyCrossInterpreterData API is used by 3rd party project on PyPI: gh-106320: Remove private _PyCrossInterpreterData API #107068 (comment). I closed my PR gh-106320: Remove private _PyCrossInterpreterData API #107068.

Linked PRs

  • gh-106320: Remove _PyInterpreterState_Get() alias #106321
  • gh-106320: Remove private _PyTraceMalloc C API functions #106324
  • gh-106320: Remove private _PyInterpreterState functions #106325
  • gh-106320: Remove private _PyInterpreterState functions #106335
  • gh-106320: Use _PyInterpreterState_GET() #106336
  • gh-106320: Add pycore_complexobject.h header file #106339
  • gh-106320: _testcapi avoids private _PyUnicode_EqualToASCIIString() #106341
  • gh-106320: Move _PyUnicodeWriter to the internal C API #106342
  • gh-106320: Create pycore_moduleobject.h header file #106355
  • gh-106320: Remove private _PyErr C API functions #106356
  • gh-106320: Remove more private _PyUnicode C API functions #106382
  • gh-106320: Remove private _PyImport C API functions #106383
  • gh-106320: Remove more private _PyUnicode C API functions (#106382) #106385
  • gh-106320: Fix _PyImport_GetModuleAttr() declaration #106386
  • gh-106320: Remove _PyUnicode_TransformDecimalAndSpaceToASCII() #106398
  • gh-106320: Remove _PyBytesWriter C API #106399
  • gh-106320: Remove private pylifecycle.h functions #106400
  • gh-106320: Add missing #include in _winapi.c #106417
  • gh-106320: Remove _PyInterpreterState_HasFeature() #106425
  • gh-106320: Fix specialize.c compilation by including pycore_pylifecycle.h #106434
  • gh-106320: Remove private _PyUnicode_AsString() alias #107021
  • gh-106320: Move private _PyHash API to the internal C API #107026
  • gh-106320: Document private C API removal in What's New 3.13 #107027
  • gh-106320: Move _PyNone_Type to the internal C API #107030
  • gh-106320: Move private _PyGen API to the internal C API #107032
  • gh-106320: Remove _PyOS_ReadlineTState API #107034
  • gh-106320: Remove _Py_SwappedOp from the C API #107036
  • gh-106320: Move private _PySet API to the internal API #107041
  • gh-106320: Remove private _PyInterpreterID C API #107053
  • gh-106320: Move _PyMethodWrapper_Type to internal C API #107064
  • gh-106320: Remove private _PyCrossInterpreterData API #107068
  • gh-106320: Remove private _PyModule API #107070
  • gh-106320: Remove _PyFunction_Vectorcall() API #107071
  • gh-106320: Remove _PyIsSelectable_fd() C API #107142
  • gh-106320: Remove _PyTuple_MaybeUntrack() C API #107143
  • gh-106320: Remove _PyBytes_Join() C API #107144
  • gh-106320: Remove private _PyDict C API #107145
  • gh-106320: Remove private _PyObject C API #107147
  • gh-106320: Remove private _PyObject C API #107159
  • gh-106320: Remove private _PyUnicode C API #107185
  • gh-106320: Remove private _PyMem API #107187
  • gh-106320: Remove _PyDict_GetItemStringWithError() function #108313
  • gh-106320: Remove private PyLong C API functions #108429
  • gh-106320: Remove private float C API functions #108430
  • gh-106320: Remove private _PyManagedBuffer_Type #108431
  • gh-106320: Remove private _PyEval function #108433
  • gh-106320: Remove private _PyContext_NewHamtForTests() #108434
  • gh-106320: Remove private _PyDict function #108449
  • gh-106320: Remove private _PyList function #108451
  • gh-106320: Remove private _PySys functions #108452
  • gh-106320: Remove private _PyTraceback functions #108453
  • gh-106320: Remove private _PyLong converter functions #108499
  • gh-106320: Remove private _PyLong_FileDescriptor_Converter() #108503
  • gh-106320: Remove private AC converter functions #108505
  • gh-106320: Remove private _Py_Identifier API #108593
  • gh-106320: Remove _PyAnextAwaitable_Type from the public C API #108597
  • gh-106320: Remove private pythonrun API #108599
  • gh-106320: Remove private _PyType_Lookup() function #108600
  • gh-106320: Remove private _PyThread_at_fork_reinit() function #108601
  • gh-106320: Remove private _Py_UniversalNewlineFgetsWithSize() #108602
  • gh-106320: Remove private _PyGILState_GetInterpreterStateUnsafe() #108603
  • gh-106320: Remove private _PyLong_New() function #108604
  • gh-106320: Remove private _PyOS_IsMainThread() function #108605
  • gh-106320: Remove private _PyObject_GetState() #108606
  • gh-106320: Remove private _PyErr_SetKeyError() #108607
  • gh-106320: Fix test_peg_generator: _Py_UniversalNewlineFgetsWithSize() #108609
  • gh-106320: Remove private _Py_ForgetReference() #108664
  • gh-106320: Don't export _Py_ForgetReference() function #108712
  • gh-106320: Remove private _PyErr_ChainExceptions() #108713
  • gh-106320: winconsoleio.c includes pycore_pyerrors.h #108720
  • gh-106320: Remove private _PyLong_IsCompact() function #108742
  • gh-106320: Remove private _PyLong_Sign() #108743
  • gh-106320: Remove private _PyErr_WriteUnraisableMsg() #108863
  • gh-106320: Re-add some PyLong/PyDict C-API functions #111162
  • gh-111262: Add PyDict_Pop() function [with default value] #111939
  • gh-106320: Document replacement for removed C API #128787
  • gh-106320: Document private C APIs promoted to public C API #128788
  • [3.13] gh-106320: Document replacement for removed C API (GH-128787) #128837
Reacted by littlebutt's workshop

Activity

Next
  1. vstinner
    added
    topic-C-API
    on Jul 1, 2023
  2. vstinner
    added 3 commits that reference this issue on Jul 1, 2023

    pythongh-106320: Remove _PyInterpreterState_Get() alias

    8cf018e

    pythongh-106320: Remove _PyInterpreterState_Get() alias

    c053d2b

    pythongh-106320: Remove _PyInterpreterState_Get() alias

    1b38110
  3. vstinner commented on Jul 1, 2023

    @vstinner
    vstinner
    on Jul 1, 2023
    MemberAuthor
    More actions

    See also issue #106316: remove pytime.h header file (_PyTime functions).

  4. vstinner commented on Jul 1, 2023

    @vstinner
    vstinner
    on Jul 1, 2023
    MemberAuthor
    More actions

    See also issue #106084: C API: Remove private functions from abstract.h.

  5. vstinner commented on Jul 1, 2023

    @vstinner
    vstinner
    on Jul 1, 2023
    MemberAuthor
    More actions

    See also commit 0b51463:

    Remove the following private functions of the C API:
    
    * _PyCodecInfo_GetIncrementalDecoder()
    * _PyCodecInfo_GetIncrementalEncoder()
    * _PyCodec_DecodeText()
    * _PyCodec_EncodeText()
    * _PyCodec_Forget()
    * _PyCodec_Lookup()
    * _PyCodec_LookupTextEncoding()
    
  6. vstinner
    added 8 commits that reference this issue on Jul 1, 2023

    pythongh-106320: Remove _PyInterpreterState_Get() alias

    096b84a

    gh-106320: Remove _PyInterpreterState_Get() alias (#106321)

    18b1fde

    pythongh-106320: Remove private _PyTracemalloc C API functions

    07d99d3

    pythongh-106320: Remove private _PyTracemalloc C API functions

    8959034

    pythongh-106320: Remove private _PyTraceMalloc C API functions

    9d0865d

    pythongh-106320: Remove private _PyInterpreterState functions

    58f66f0

    gh-106320: Remove private _PyTraceMalloc C API functions (#106324)

    feb51f3

    pythongh-106320: Remove private _PyInterpreterState functions

    b403d1a
  7. 284 remaining items

    Load more actions
  8. vstinner commented on Jan 13, 2025

    @vstinner
    vstinner
    on Jan 13, 2025
    MemberAuthor
    More actions

    @clin1234:

    @vstinner Given the number of commits in various projects affected by this, perhaps there should a comprehensive list of replacement functions for each corresponding private function included in the What's New section within 3.13's documentation.

    Good idea: I created #128787 for that.

  9. vstinner
    added 3 commits that reference this issue on Jan 13, 2025

    pythongh-106320: Document private C APIs promoted to public C API

    eddf0ed

    gh-106320: Document private C APIs promoted to public C API (#128788)

    41f7350

    gh-106320: Document replacement for removed C API (#128787)

    43ef958
  10. miss-islington
    added a commit that references this issue on Jan 14, 2025

    pythongh-106320: Document replacement for removed C API (pythonGH-128787

    6baa1d4
  11. vstinner
    added a commit that references this issue on Jan 14, 2025

    [3.13] gh-106320: Document replacement for removed C API (GH-128787) (#…

    d2a8d57
  12. adorilson
    added a commit that references this issue on Jun 8, 2025

    pythongh-106320: Remove private _PyInterpreterState functions (python…

    6521268
  13. adorilson
    added 2 commits that reference this issue on Jul 22, 2025

    pythongh-106320: Remove private _PyInterpreterState functions (python…

    3253a52

    pythongh-106320: Remove private _PyInterpreterState functions (python…

    db8893c
  14. orsenthil
    added a commit that references this issue on Aug 8, 2025

    [Doc] Remove unnecessary quotes from typing module (#137207)

    f06fcb7
  15. miss-islington
    added 2 commits that reference this issue on Aug 8, 2025

    [Doc] Remove unnecessary quotes from typing module (pythonGH-137207)

    02de167

    [Doc] Remove unnecessary quotes from typing module (pythonGH-137207)

    86aee83
  16. orsenthil
    added a commit that references this issue on Aug 8, 2025

    [3.13] [Doc] Remove unnecessary quotes from typing module (GH-137207) (…

    3491368
  17. adorilson
    added a commit that references this issue on Aug 8, 2025

    pythongh-106320: Remove private _PyInterpreterState functions (python…

    85664f3
  18. Agent-Hellboy
    added a commit that references this issue on Aug 19, 2025

    [Doc] Remove unnecessary quotes from typing module (python#137207)

    7e46457
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-C-API

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.