bpo-39542: Make PyObject_INIT() opaque in limited C API by vstinner · Pull Request #18363 · python/cpython

In the limited C API, PyObject_INIT() and PyObject_INIT_VAR() are now
defined as aliases to PyObject_Init() and PyObject_InitVar() to make
their implementation opaque. It avoids to leak implementation details
in the limited C API.

Exclude the following functions from the limited C API, move them
from object.h to cpython/object.h:

  • _Py_NewReference()
  • _Py_ForgetReference()
  • _PyTraceMalloc_NewReference()
  • _Py_GetRefTotal()

https://bugs.python.org/issue39542