gh-106320: Remove private _PyDict C API#107145
Conversation
|
For now, I kept _PyDict_GetItemStringWithError() since it's used by _testcapi. The new public PyDict_GetItemStringRef() can be used by _testcapi instead. |
|
@methane: Do you want to prefer to keep a few of these private _PyDict functions for now? Or is it ok to remove them right now from the C API? If one of these private functions make sense outside CPython code base, we should consider making it public: see https://discuss.python.org/t/c-api-my-plan-to-clarify-private-vs-public-functions-in-python-3-13/30131 |
|
With this PR, there are still the following private _PyDict functions:
I consider removing them later, except of the "Id" variants. |
|
Cython uses |
|
The main branch of Cython uses the following private _PyDict functions:
Ok, let's keep these one for them, until we decide if we should make them public, or if Cython should avoid them. |
Move private _PyDict functions to the internal C API (pycore_dict.h): * _PyDict_Contains_KnownHash() * _PyDict_DebugMallocStats() * _PyDict_DelItemIf() * _PyDict_GetItemWithError() * _PyDict_HasOnlyStringKeys() * _PyDict_MaybeUntrack() * _PyDict_MergeEx() No longer export these functions.
|
I updated my PR to keep the following functions:
I also rebased it on the main branch. |
* main: (73 commits) Thoroughly refactor the cases generator (python#107151) Docs: Add missing markup to Argument Clinic docs (python#106876) pythongh-107162: Document errcode.h usage in its comment (python#107177) pythongh-106320: Remove private _PyDict C API (python#107145) Fix PyVectorcall_Function doc versionadded (python#107140) Docs: Remove duplicate word in Argument Clinic howto heading (python#107169) pythongh-107017: Change Chapter Strings to Texts in the Introduction chapter. (python#107104) pythongh-106320: Remove private _PyObject C API (python#107159) Docs: fix typo in os.pwrite docstring (python#107087) pythongh-105291: Add link to migration guide for distutils (python#107130) pythongh-106948: Docs: Disable links for C standard library functions, OS utility functions and system calls (python#107062) pythongh-106320: Remove _PyBytes_Join() C API (python#107144) pythongh-106320: Remove private _PyObject C API (python#107147) pythongh-106320: Remove _PyTuple_MaybeUntrack() C API (python#107143) pythongh-106320: Remove _PyIsSelectable_fd() C API (python#107142) Remove superflous whitespaces in `layout.html`. (pythonGH-107067) pythongh-107122: Update what's news for dbm.*dbm.clear() method (pythongh-107135) pythongh-107122: Add clear method to dbm.ndbm module (pythongh-107126) pythongh-62519: Make pgettext search plurals when translation is not found (python#107118) pythongh-107122: Add clear method to dbm.gdbm.module (pythongh-107127) ...
Move private _PyDict functions to the internal C API (pycore_dict.h):
No longer export these functions.