Supporting Cyclic Garbage Collection — Python 3.11.16 documentation

docs.python.org

Tin mới

API and ABI Versioning

Python Module Index

3.11.16 Documentation

Python/C API Reference Manual

Object Implementation Support

PyTypeObject.tp_flags

Python’s support for detecting and collecting garbage which involves circular references requires support from object types which are “containers” for other objects which may also be containers. Types which do not store

PyType_FromSpecWithBases()

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

sys.unraisablehook

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