Skip to content

Commit a009e78

Browse files
authored
gh-141004: Mark up docs of old PyMem macros (GH-143783)
These had a docs-only deprecation notice since the first version of the docs in this repo. Nowadays we call things “soft deprecated” if there's just a note in the docs. The deprecated directive needs a version, I went with the first one that had the notice (2.0; it's not in 1.6): - https://docs.python.org/release/2.0/api/memoryInterface.html - https://docs.python.org/release/1.6/api/memoryInterface.html Since PEP 445, they are now direct aliases; there are no (additional) binary compatibility concerns over the preferred names.
1 parent 1597d00 commit a009e78

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

Doc/c-api/memory.rst

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,39 @@ The following type-oriented macros are provided for convenience. Note that
293293
294294
Same as :c:func:`PyMem_Free`.
295295
296-
In addition, the following macro sets are provided for calling the Python memory
297-
allocator directly, without involving the C API functions listed above. However,
298-
note that their use does not preserve binary compatibility across Python
299-
versions and is therefore deprecated in extension modules.
300-
301-
* ``PyMem_MALLOC(size)``
302-
* ``PyMem_NEW(type, size)``
303-
* ``PyMem_REALLOC(ptr, size)``
304-
* ``PyMem_RESIZE(ptr, type, size)``
305-
* ``PyMem_FREE(ptr)``
306-
* ``PyMem_DEL(ptr)``
296+
297+
Deprecated aliases
298+
------------------
299+
300+
These are :term:`soft deprecated` aliases to existing functions and macros.
301+
They exist solely for backwards compatibility.
302+
303+
.. list-table::
304+
:widths: auto
305+
:header-rows: 1
306+
307+
* * Deprecated alias
308+
* Corresponding function or macro
309+
* * .. c:macro:: PyMem_MALLOC(size)
310+
* :c:func:`PyMem_Malloc`
311+
* * .. c:macro:: PyMem_NEW(type, size)
312+
* :c:macro:`PyMem_New`
313+
* * .. c:macro:: PyMem_REALLOC(ptr, size)
314+
* :c:func:`PyMem_Realloc`
315+
* * .. c:macro:: PyMem_RESIZE(ptr, type, size)
316+
* :c:macro:`PyMem_Resize`
317+
* * .. c:macro:: PyMem_FREE(ptr)
318+
* :c:func:`PyMem_Free`
319+
* * .. c:macro:: PyMem_DEL(ptr)
320+
* :c:func:`PyMem_Free`
321+
322+
.. versionchanged:: 3.4
323+
324+
The macros are now aliases of the corresponding functions and macros.
325+
Previously, their behavior was the same, but their use did not necessarily
326+
preserve binary compatibility across Python versions.
327+
328+
.. deprecated:: 2.0
307329
308330
309331
.. _objectinterface:

0 commit comments

Comments
 (0)