Allocating objects on the heap — Python 3.14.7 documentation

docs.python.org

Tin mới

Object Implementation Support

Python Module Index

3.14.7 Documentation

Python/C API reference manual

PyTypeObject.tp_init

Initialize a newly allocated object op with its type and initial reference. Returns the initialized object. Other fields of the object are not initialized. Despite its name, this function is unrelated to the object’s __i

PyType_GenericAlloc()

Initialize a newly allocated object op with its type and initial reference. Returns the initialized object. Other fields of the object are not initialized. Despite its name, this function is unrelated to the object’s __i

PyObject_GC_NewVar

It allocates enough memory for the TYPE structure plus size (Py_ssize_t) fields of the size given by the tp_itemsize field of typeobj.

PyObject_Realloc()