From aa829e1c0e81fd3087650ea32a42ca5e57b93504 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Tue, 13 Jan 2026 12:38:31 +0100 Subject: [PATCH] gh-141004: Mark up docs of old PyMem macros Their docs-only deprecation notice appeared 2.0: https://docs.python.org/release/2.0/api/memoryInterface.html but not 1.6: https://docs.python.org/release/2.0/api/memoryInterface.html Nowadays we call this soft deprecation. Since PEP 445, they are now direct aliases; there are no (additional) binary compatibility concerns over the preferred names. --- Doc/c-api/memory.rst | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst index 2395898010214d..1f042fe8d93ad1 100644 --- a/Doc/c-api/memory.rst +++ b/Doc/c-api/memory.rst @@ -293,17 +293,23 @@ The following type-oriented macros are provided for convenience. Note that Same as :c:func:`PyMem_Free`. -In addition, the following macro sets are provided for calling the Python memory -allocator directly, without involving the C API functions listed above. However, -note that their use does not preserve binary compatibility across Python -versions and is therefore deprecated in extension modules. - -* ``PyMem_MALLOC(size)`` -* ``PyMem_NEW(type, size)`` -* ``PyMem_REALLOC(ptr, size)`` -* ``PyMem_RESIZE(ptr, type, size)`` -* ``PyMem_FREE(ptr)`` -* ``PyMem_DEL(ptr)`` +.. c:macro:: PyMem_MALLOC(size) + PyMem_NEW(type, size) + PyMem_REALLOC(ptr, size) + PyMem_RESIZE(ptr, type, size) + PyMem_FREE(ptr) + PyMem_DEL(ptr) + + These macros are :term:`soft deprecated` aliases for the APIs above, + provided for backwards compatibility. + + .. versionchanged:: 3.4 + + The macros are now aliases of the corresponding mixed-case names. + Previously, their of the macros was the same, but their use did + not preserve binary compatibility across Python versions. + + .. deprecated:: 2.0 .. _objectinterface: