Skip to content

Commit 571bea1

Browse files
committed
Doc: move Py_REFCNT and Py_SET_REFCNT from structures.rst to the reference counting page
1 parent 3378ebb commit 571bea1

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
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: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -121,26 +121,6 @@ the definition of all other Python objects.
121121
.. versionadded:: 3.9
122122
123123
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-
144124
.. c:function:: Py_ssize_t Py_SIZE(PyVarObject *o)
145125
146126
Get the size of the Python object *o*.

0 commit comments

Comments
 (0)