Conteo de referencias
*********************

Los macros de esta sección se utilizan para administrar conteos de
referencia de objetos Python.

void Py_INCREF(PyObject *o)

   Indicate taking a new *strong reference* to object *o*, indicating
   it is in use and should not be destroyed.

   Esta función se usa generalmente para convertir un *borrowed
   reference* en un *strong reference* en su lugar. La función
   "Py_NewRef()" se puede utilizar para crear un nuevo *strong
   reference*.

   When done using the object, release it by calling "Py_DECREF()".

   El objeto no debe ser "NULL"; si no está seguro de que no sea
   "NULL", use "Py_XINCREF()".

   Do not expect this function to actually modify *o* in any way.

void Py_XINCREF(PyObject *o)

   Similar to "Py_INCREF()", but the object *o* can be "NULL", in
   which case this has no effect.

   Ver también "Py_XNewRef()".

PyObject *Py_NewRef(PyObject *o)
    * Part of the Stable ABI since version 3.10.*

   Create a new *strong reference* to an object: call "Py_INCREF()" on
   *o* and return the object *o*.

   When the *strong reference* is no longer needed, "Py_DECREF()"
   should be called on it to release the reference.

   El objeto *o* no debe ser "NULL"; use "Py_XNewRef()" si *o* puede
   ser "NULL".

   Por ejemplo:

      Py_INCREF(obj);
      self->attr = obj;

   puede ser escrito como:

      self->attr = Py_NewRef(obj);

   Ver también "Py_INCREF()".

   Nuevo en la versión 3.10.

PyObject *Py_XNewRef(PyObject *o)
    * Part of the Stable ABI since version 3.10.*

   Similar a "Py_NewRef()", pero el objeto *o* puede ser NULL.

   Si el objeto *o* es "NULL", la función solo retorna "NULL".

   Nuevo en la versión 3.10.

void Py_DECREF(PyObject *o)

   Release a *strong reference* to object *o*, indicating the
   reference is no longer used.

   Once the last *strong reference* is released (i.e. the object's
   reference count reaches 0), the object's type's deallocation
   function (which must not be "NULL") is invoked.

   Esta función se usa generalmente para eliminar un *strong
   reference* antes de salir de su alcance.

   El objeto no debe ser "NULL"; si no está seguro de que no sea
   "NULL", use "Py_XINCREF()".

   Do not expect this function to actually modify *o* in any way.

   Advertencia:

     La función de desasignación puede hacer que se invoque un código
     arbitrario de Python (por ejemplo, cuando se desasigna una
     instancia de clase con un método "__del__()"). Si bien las
     excepciones en dicho código no se propagan, el código ejecutado
     tiene acceso libre a todas las variables globales de Python. Esto
     significa que cualquier objeto al que se pueda acceder desde una
     variable global debe estar en un estado coherente antes de
     invocar "Py_DECREF()". Por ejemplo, el código para eliminar un
     objeto de una lista debe copiar una referencia al objeto
     eliminado en una variable temporal, actualizar la estructura de
     datos de la lista y luego llamar a "Py_DECREF()" para la variable
     temporal.

void Py_XDECREF(PyObject *o)

   Similar to "Py_DECREF()", but the object *o* can be "NULL", in
   which case this has no effect. The same warning from "Py_DECREF()"
   applies here as well.

void Py_CLEAR(PyObject *o)

   Release a *strong reference* for object *o*. The object may be
   "NULL", in which case the macro has no effect; otherwise the effect
   is the same as for "Py_DECREF()", except that the argument is also
   set to "NULL".  The warning for "Py_DECREF()" does not apply with
   respect to the object passed because the macro carefully uses a
   temporary variable and sets the argument to "NULL" before releasing
   the reference.

   It is a good idea to use this macro whenever releasing a reference
   to an object that might be traversed during garbage collection.

void Py_IncRef(PyObject *o)
    * Part of the Stable ABI.*

   Indicate taking a new *strong reference* to object *o*. A function
   version of "Py_XINCREF()". It can be used for runtime dynamic
   embedding of Python.

void Py_DecRef(PyObject *o)
    * Part of the Stable ABI.*

   Release a *strong reference* to object *o*. A function version of
   "Py_XDECREF()". It can be used for runtime dynamic embedding of
   Python.

Las siguientes funciones o macros son solo para uso dentro del núcleo
del intérprete: "_Py_Dealloc()", "_Py_ForgetReference()",
"_Py_NewReference()", así como la variable global "_Py_RefTotal".
