Skip to content

Commit 58a3d28

Browse files
CharlieZhao95erlend-aaslandJelleZijlstra
authored
pythongh-91755: Document Py_IncRef and Py_DecRef as C functions (python#91805)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
1 parent b86d783 commit 58a3d28

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Doc/c-api/refcounting.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,17 @@ objects.
109109
It is a good idea to use this macro whenever decrementing the reference
110110
count of an object that might be traversed during garbage collection.
111111
112+
.. c:function:: void Py_IncRef(PyObject *o)
113+
114+
Increment the reference count for object *o*. A function version of :c:func:`Py_XINCREF`.
115+
It can be used for runtime dynamic embedding of Python.
116+
117+
118+
.. c:function:: void Py_DecRef(PyObject *o)
119+
120+
Decrement the reference count for object *o*. A function version of :c:func:`Py_XDECREF`.
121+
It can be used for runtime dynamic embedding of Python.
112122
113-
The following functions are for runtime dynamic embedding of Python:
114-
``Py_IncRef(PyObject *o)``, ``Py_DecRef(PyObject *o)``. They are
115-
simply exported function versions of :c:func:`Py_XINCREF` and
116-
:c:func:`Py_XDECREF`, respectively.
117123
118124
The following functions or macros are only for use within the interpreter core:
119125
:c:func:`_Py_Dealloc`, :c:func:`_Py_ForgetReference`, :c:func:`_Py_NewReference`,

0 commit comments

Comments
 (0)