Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Doc: move Py_REFCNT and Py_SET_REFCNT from structures.rst to the refe…
…rence counting page
  • Loading branch information
QuakeIV committed Oct 12, 2022
commit 571bea1a1223a51ac90c9e6ea4c10483e39cc93b
20 changes: 20 additions & 0 deletions Doc/c-api/refcounting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ The macros in this section are used for managing reference counts of Python
objects.


.. c:function:: Py_ssize_t Py_REFCNT(PyObject *o)

Get the reference count of the Python object *o*.

Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count.

.. versionchanged:: 3.11
The parameter type is no longer :c:expr:`const PyObject*`.

.. versionchanged:: 3.10
:c:func:`Py_REFCNT()` is changed to the inline static function.


.. c:function:: void Py_SET_REFCNT(PyObject *o, Py_ssize_t refcnt)

Set the object *o* reference counter to *refcnt*.

.. versionadded:: 3.9


.. c:function:: void Py_INCREF(PyObject *o)

Increment the reference count for object *o*.
Expand Down
20 changes: 0 additions & 20 deletions Doc/c-api/structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,26 +121,6 @@ the definition of all other Python objects.
.. versionadded:: 3.9


.. c:function:: Py_ssize_t Py_REFCNT(PyObject *o)

Get the reference count of the Python object *o*.

Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count.

.. versionchanged:: 3.11
The parameter type is no longer :c:expr:`const PyObject*`.

.. versionchanged:: 3.10
:c:func:`Py_REFCNT()` is changed to the inline static function.


.. c:function:: void Py_SET_REFCNT(PyObject *o, Py_ssize_t refcnt)

Set the object *o* reference counter to *refcnt*.

.. versionadded:: 3.9


.. c:function:: Py_ssize_t Py_SIZE(PyVarObject *o)

Get the size of the Python object *o*.
Expand Down