Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions Doc/c-api/memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment on lines +296 to +301
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to have a table, similar to what I did here.


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
Copy link
Member

@vstinner vstinner Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't get the sentence: "their of the macros was the same".

not preserve binary compatibility across Python versions.

.. deprecated:: 2.0


.. _objectinterface:
Expand Down
Loading