8000 gh-96258: move Py_REFCNT and Py_SET_REFCNT to reference counting page… · python/cpython@4e2bd58 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4e2bd58

Browse files
authored
gh-96258: move Py_REFCNT and Py_SET_REFCNT to reference counting page (#96259)
1 parent bf786e6 commit 4e2bd58

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

Doc/c-api/refcounting.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@ The macros in this section are used for managing reference counts of Python
1111
objects.
1212

1313

14+
.. c:function:: Py_ssize_t Py_REFCNT(PyObject *o)
15+
16+
Get the reference count of the Python object *o*.
17+
18+
Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count.
19+
20+
.. versionchanged:: 3.11
21+
The parameter type is no longer :c:expr:`const PyObject*`.
22+
23+
.. versionchanged:: 3.10
24+
:c:func:`Py_REFCNT()` is changed to the inline static function.
25+
26+
27+
.. c:function:: void Py_SET_REFCNT(PyObject *o, Py_ssize_t refcnt)
28+
29+
Set the object *o* reference counter to *refcnt*.
30+
31+
.. versionadded:: 3.9
32+
33+
1434
.. c:function:: void Py_INCREF(PyObject *o)
1535
1636
Increment the reference count for object *o*.

Doc/c-api/structures.rst

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ All Python objects ultimately share a small number of fields at the beginning
1717
of the object's representation in memory. These are represented by the
1818
:c:type:`PyObject` and :c:type:`PyVarObject` types, which are defined, in turn,
1919
by the expansions of some macros also used, whether directly or indirectly, in
20-
the definition of all other Python objects.
20+
the definition of all other Python objects. Additional macros can be found
21+
under :ref:`reference counting <countingrefs>`.
2122

2223

2324
.. c:type:: PyObject
@@ -121,26 +122,6 @@ the definition of all other Python objects.
121122
.. versionadded:: 3.9
122123
123124
124-
.. c:function:: Py_ssize_t Py_REFCNT(PyObject *o)
125-
126-
Get the reference count of the Python object *o*.
127-
128-
Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count.
129-
130-
.. versionchanged:: 3.11
131-
The parameter type is no longer :c:expr:`const PyObject*`.
132-
133-
.. versionchanged:: 3.10
134-
:c:func:`Py_REFCNT()` is changed to the inline static function.
135-
136-
137-
.. c:function:: void Py_SET_REFCNT(PyObject *o, Py_ssize_t refcnt)
138-
139-
Set the object *o* reference counter to *refcnt*.
140-
141-
.. versionadded:: 3.9
142-
143-
144125
.. c:function:: Py_ssize_t Py_SIZE(PyVarObject *o)
145126
146127
Get the size of the Python object *o*.

0 commit comments

Comments
 (0)
0