Reference Counting

The macros in this section are used for managing reference counts of Python objects.

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 :cfunc:`Py_XINCREF` and :cfunc:`Py_XDECREF`, respectively.

The following functions or macros are only for use within the interpreter core: :cfunc:`_Py_Dealloc`, :cfunc:`_Py_ForgetReference`, :cfunc:`_Py_NewReference`, as well as the global variable :cdata:`_Py_RefTotal`.