Supporting Cyclic Garbage Collection — Python 3.14.7 documentation

docs.python.org

Tin mới

Type Object Structures

API and ABI Versioning

Python Module Index

3.14.7 Documentation

Python/C API reference manual

Object Implementation Support

PyType_FromSpecWithBases()

The object’s memory must be deallocated using PyObject_GC_Del().

Python object header

Analogous to PyObject_GC_New but allocates extra_size bytes at the end of the object (at offset tp_basicsize). The allocated memory is initialized to zeros, except for the Python object header.

sys.unraisablehook

Perform a full garbage collection, if the garbage collector is enabled. (Note that gc.collect() runs it unconditionally.)