PyObject
PyObject is the core data structure for all Python objects in the CPython reference implementation. In CPython’s C API, every Python object is represented at the C level as a PyObject or as a struct that begins with the PyObject header. The PyObject structure contains the object's reference count and a pointer to its type object. The type object, implemented as PyTypeObject, defines the object's behavior, including how it is deallocated, compared, converted, and how attributes are accessed.
Concrete Python types (such as lists, dictionaries, strings, or functions) typically define their C structs with
Memory management relies primarily on reference counting. The API provides macros such as Py_INCREF and Py_DECREF
In practice, most C extensions and embedding code manipulate PyObject* pointers. Type information is accessible at
PyObject is defined in Include/object.h, and its header macro usage (such as PyObject_HEAD) standardizes object layout