Skip to content

Commit 7b3f7ff

Browse files
[3.13] gh-141004: Document deprecated aliases for memory allocation (GH-141146) (GH-141289)
* gh-141004: Document deprecated aliases for memory allocation (GH-141146) (cherry picked from commit 1d738de)
1 parent 718886f commit 7b3f7ff

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

Doc/c-api/allocation.rst

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@ Allocating Objects on the Heap
5858
use :c:func:`PyObject_GC_NewVar` instead.
5959
6060
61-
.. c:function:: void PyObject_Del(void *op)
62-
63-
Releases memory allocated to an object using :c:macro:`PyObject_New` or
64-
:c:macro:`PyObject_NewVar`. This is normally called from the
65-
:c:member:`~PyTypeObject.tp_dealloc` handler specified in the object's type. The fields of
66-
the object should not be accessed after this call as the memory is no
67-
longer a valid Python object.
68-
69-
7061
.. c:var:: PyObject _Py_NoneStruct
7162
7263
Object which is visible in Python as ``None``. This should only be accessed
@@ -79,3 +70,35 @@ Allocating Objects on the Heap
7970
:ref:`moduleobjects`
8071
To allocate and create extension modules.
8172
73+
74+
Deprecated aliases
75+
^^^^^^^^^^^^^^^^^^
76+
77+
These are :term:`soft deprecated` aliases to existing functions and macros.
78+
They exist solely for backwards compatibility.
79+
80+
81+
.. list-table::
82+
:widths: auto
83+
:header-rows: 1
84+
85+
* * Deprecated alias
86+
* Function
87+
* * .. c:macro:: PyObject_NEW(type, typeobj)
88+
* :c:macro:`PyObject_New`
89+
* * .. c:macro:: PyObject_NEW_VAR(type, typeobj, n)
90+
* :c:macro:`PyObject_NewVar`
91+
* * .. c:macro:: PyObject_INIT(op, typeobj)
92+
* :c:func:`PyObject_Init`
93+
* * .. c:macro:: PyObject_INIT_VAR(op, typeobj, n)
94+
* :c:func:`PyObject_InitVar`
95+
* * .. c:macro:: PyObject_MALLOC(n)
96+
* :c:func:`PyObject_Malloc`
97+
* * .. c:macro:: PyObject_REALLOC(p, n)
98+
* :c:func:`PyObject_Realloc`
99+
* * .. c:macro:: PyObject_FREE(p)
100+
* :c:func:`PyObject_Free`
101+
* * .. c:macro:: PyObject_DEL(p)
102+
* :c:func:`PyObject_Free`
103+
* * .. c:macro:: PyObject_Del(p)
104+
* :c:func:`PyObject_Free`

0 commit comments

Comments
 (0)