typedef struct _typeobject {1PyObject_VAR_HEAD2const char *tp_name; /* For printing, in format "<module>.<name>" */3Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */45/* Methods to implement standard operations */67destructor tp_dealloc;8Py_ssize_t tp_vectorcall_offset;9getattrfunc tp_getattr;10setattrfunc tp_setattr;11PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)12or tp_reserved (Python 3) */13reprfunc tp_repr;1415/* Method suites for standard classes */1617PyNumberMethods *tp_as_number;18PySequenceMethods *tp_as_sequence;19PyMappingMethods *tp_as_mapping;2021/* More standard operations (here for binary compatibility) */2223hashfunc tp_hash;24ternaryfunc tp_call;25reprfunc tp_str;26getattrofunc tp_getattro;27setattrofunc tp_setattro;2829/* Functions to access object as input/output buffer */30PyBufferProcs *tp_as_buffer;3132/* Flags to define presence of optional/expanded features */33unsigned long tp_flags;3435const char *tp_doc; /* Documentation string */3637/* Assigned meaning in release 2.0 */38/* call function for all accessible objects */39traverseproc tp_traverse;4041/* delete references to contained objects */42inquiry tp_clear;4344/* Assigned meaning in release 2.1 */45/* rich comparisons */46richcmpfunc tp_richcompare;4748/* weak reference enabler */49Py_ssize_t tp_weaklistoffset;5051/* Iterators */52getiterfunc tp_iter;53iternextfunc tp_iternext;5455/* Attribute descriptor and subclassing stuff */56struct PyMethodDef *tp_methods;57struct PyMemberDef *tp_members;58struct PyGetSetDef *tp_getset;59// Strong reference on a heap type, borrowed reference on a static type60struct _typeobject *tp_base;61PyObject *tp_dict;62descrgetfunc tp_descr_get;63descrsetfunc tp_descr_set;64Py_ssize_t tp_dictoffset;65initproc tp_init;66allocfunc tp_alloc;67newfunc tp_new;68freefunc tp_free; /* Low-level free-memory routine */69inquiry tp_is_gc; /* For PyObject_IS_GC */70PyObject *tp_bases;71PyObject *tp_mro; /* method resolution order */72PyObject *tp_cache;73PyObject *tp_subclasses;74PyObject *tp_weaklist;75destructor tp_del;7677/* Type attribute cache version tag. Added in version 2.6 */78unsigned int tp_version_tag;7980destructor tp_finalize;81vectorcallfunc tp_vectorcall;8283/* bitset of which type-watchers care about this type */84char tp_watched;85} PyTypeObject;868788