[Python-checkins] gh-91755: Document Py_IncRef and Py_DecRef as C functions (GH-91805)

miss-islington webhook-mailer at python.org
Wed May 18 05:00:15 EDT 2022


https://github.com/python/cpython/commit/1815d8e64fd0bf9fc5fadc2af928a60e380a5c06
commit: 1815d8e64fd0bf9fc5fadc2af928a60e380a5c06
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-05-18T02:00:00-07:00
summary:

gh-91755: Document Py_IncRef and Py_DecRef as C functions (GH-91805)


Co-authored-by: Erlend Egeberg Aasland <erlend.aasland at protonmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra at gmail.com>
(cherry picked from commit 58a3d28039863b014f57a1ac93b51e20920ebe7b)

Co-authored-by: Charlie Zhao <zhaoyu_hit at qq.com>

files:
M Doc/c-api/refcounting.rst

diff --git a/Doc/c-api/refcounting.rst b/Doc/c-api/refcounting.rst
index 391907c8c2976..738bd77e9ce42 100644
--- a/Doc/c-api/refcounting.rst
+++ b/Doc/c-api/refcounting.rst
@@ -109,11 +109,17 @@ objects.
    It is a good idea to use this macro whenever decrementing the reference
    count of an object that might be traversed during garbage collection.
 
+.. c:function:: void Py_IncRef(PyObject *o)
+
+   Increment the reference count for object *o*. A function version of :c:func:`Py_XINCREF`.
+   It can be used for runtime dynamic embedding of Python.
+
+
+.. c:function:: void Py_DecRef(PyObject *o)
+
+   Decrement the reference count for object *o*. A function version of :c:func:`Py_XDECREF`.
+   It can be used for runtime dynamic embedding of Python.
 
-The following functions are for runtime dynamic embedding of Python:
-``Py_IncRef(PyObject *o)``, ``Py_DecRef(PyObject *o)``. They are
-simply exported function versions of :c:func:`Py_XINCREF` and
-:c:func:`Py_XDECREF`, respectively.
 
 The following functions or macros are only for use within the interpreter core:
 :c:func:`_Py_Dealloc`, :c:func:`_Py_ForgetReference`, :c:func:`_Py_NewReference`,



More information about the Python-checkins mailing list