Skip to content

Commit 2844336

Browse files
authored
bpo-39542: Document limited C API changes (GH-18378)
1 parent 427c84f commit 2844336

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

Doc/whatsnew/3.9.rst

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,6 @@ Optimizations
319319
Build and C API Changes
320320
=======================
321321

322-
* Provide :c:func:`Py_EnterRecursiveCall` and :c:func:`Py_LeaveRecursiveCall`
323-
as regular functions for the limited API. Previously, there were defined as
324-
macros, but these macros didn't work with the limited API which cannot access
325-
``PyThreadState.recursion_depth`` field. Remove ``_Py_CheckRecursionLimit``
326-
from the stable ABI.
327-
(Contributed by Victor Stinner in :issue:`38644`.)
328-
329322
* Add a new public :c:func:`PyObject_CallNoArgs` function to the C API, which
330323
calls a callable Python object without any arguments. It is the most efficient
331324
way to call a callable Python object without any argument.
@@ -359,6 +352,48 @@ Build and C API Changes
359352
* The ``COUNT_ALLOCS`` special build macro has been removed.
360353
(Contributed by Victor Stinner in :issue:`39489`.)
361354

355+
* Changes in the limited C API (if ``Py_LIMITED_API`` macro is defined):
356+
357+
* Provide :c:func:`Py_EnterRecursiveCall` and :c:func:`Py_LeaveRecursiveCall`
358+
as regular functions for the limited API. Previously, there were defined as
359+
macros, but these macros didn't work with the limited API which cannot
360+
access ``PyThreadState.recursion_depth`` field.
361+
362+
* Exclude the following functions from the limited C API:
363+
364+
* ``_Py_CheckRecursionLimit``
365+
* ``_Py_NewReference()``
366+
* ``_Py_ForgetReference()``
367+
* ``_PyTraceMalloc_NewReference()``
368+
* ``_Py_GetRefTotal()``
369+
* The trashcan mechanism which never worked in the limited C API.
370+
* ``PyTrash_UNWIND_LEVEL``
371+
* ``Py_TRASHCAN_BEGIN_CONDITION``
372+
* ``Py_TRASHCAN_BEGIN``
373+
* ``Py_TRASHCAN_END``
374+
* ``Py_TRASHCAN_SAFE_BEGIN``
375+
* ``Py_TRASHCAN_SAFE_END``
376+
377+
* The following static inline functions or macros become regular "opaque"
378+
function to hide implementation details:
379+
380+
* ``_Py_NewReference()``
381+
* ``PyObject_INIT()`` and ``PyObject_INIT_VAR()`` become aliases to
382+
:c:func:`PyObject_Init` and :c:func:`PyObject_InitVar` in the limited C
383+
API, but are overriden with static inline function otherwise. Thanks to
384+
that, it was possible to exclude ``_Py_NewReference()`` from the limited
385+
C API.
386+
387+
* Move following functions and definitions to the internal C API:
388+
389+
* ``_PyDebug_PrintTotalRefs()``
390+
* ``_Py_PrintReferences()``
391+
* ``_Py_PrintReferenceAddresses()``
392+
* ``_Py_tracemalloc_config``
393+
* ``_Py_AddToAllObjects()`` (specific to ``Py_TRACE_REFS`` build)
394+
395+
(Contributed by Victor Stinner in :issue:`38644` and :issue:`39542`.)
396+
362397

363398
Deprecated
364399
==========

0 commit comments

Comments
 (0)