bpo-39573: Add Py_SET_REFCNT() function (GH-18389)

Add a Py_SET_REFCNT() function to set the reference counter of an
object.
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst
index 0c66138..100573c 100644
--- a/Doc/c-api/structures.rst
+++ b/Doc/c-api/structures.rst
@@ -79,6 +79,13 @@
       (((PyObject*)(o))->ob_refcnt)
 
 
+.. c:function:: void Py_SET_REFCNT(PyObject *o, Py_ssize_t refcnt)
+
+   Set the object *o* reference counter to *refcnt*.
+
+   .. versionadded:: 3.9
+
+
 .. c:macro:: Py_SIZE(o)
 
    This macro is used to access the :attr:`ob_size` member of a Python object.