- tp_alloc
allocfunc tp_alloc;
Attribute descriptor and subclassing stuff
- tp_as_buffer
PyBufferProcs* tp_as_buffer;
Functions to access object as input/output buffer
- tp_as_mapping
PyMappingMethods* tp_as_mapping;
Method suites for standard classes
- tp_as_number
PyNumberMethods* tp_as_number;
- tp_as_sequence
PySequenceMethods* tp_as_sequence;
Method suites for standard classes
- tp_base
PyTypeObject* tp_base;
Attribute descriptor and subclassing stuff
- tp_bases
PyObject* tp_bases;
- tp_basicsize
Py_ssize_t tp_basicsize;
- tp_cache
PyObject* tp_cache;
- tp_call
ternaryfunc tp_call;
More standard operations (here for binary compatibility)
- tp_clear
inquiry tp_clear;
delete references to contained objects
- tp_dealloc
destructor tp_dealloc;
Methods to implement standard operations
- tp_del
destructor tp_del;
- tp_descr_get
descrgetfunc tp_descr_get;
- tp_descr_set
descrsetfunc tp_descr_set;
- tp_dict
PyObject* tp_dict;
- tp_dictoffset
Py_ssize_t tp_dictoffset;
Attribute descriptor and subclassing stuff
- tp_doc
const(char)* tp_doc;
- tp_flags
C_long tp_flags;
Flags to define presence of optional/expanded features
- tp_free
freefunc tp_free;
Low-level free-memory routine
- tp_getattr
getattrfunc tp_getattr;
Methods to implement standard operations
- tp_getattro
getattrofunc tp_getattro;
More standard operations (here for binary compatibility)
- tp_getset
PyGetSetDef* tp_getset;
Attribute descriptor and subclassing stuff
- tp_hash
hashfunc tp_hash;
More standard operations (here for binary compatibility)
- tp_init
initproc tp_init;
Attribute descriptor and subclassing stuff
- tp_is_gc
inquiry tp_is_gc;
- tp_itemsize
Py_ssize_t tp_itemsize;
- tp_iter
getiterfunc tp_iter;
- tp_iternext
iternextfunc tp_iternext;
- tp_members
PyMemberDef* tp_members;
Attribute descriptor and subclassing stuff
- tp_methods
PyMethodDef* tp_methods;
Attribute descriptor and subclassing stuff
- tp_mro
PyObject* tp_mro;
- tp_name
const(char)* tp_name;
For printing, in format "<module>.<name>"
- tp_new
newfunc tp_new;
Attribute descriptor and subclassing stuff
- tp_print
printfunc tp_print;
- tp_repr
reprfunc tp_repr;
- tp_reserved
void* tp_reserved;
Methods to implement standard operations
- tp_richcompare
richcmpfunc tp_richcompare;
- tp_setattr
setattrfunc tp_setattr;
Methods to implement standard operations
- tp_setattro
setattrofunc tp_setattro;
- tp_str
reprfunc tp_str;
More standard operations (here for binary compatibility)
- tp_subclasses
PyObject* tp_subclasses;
- tp_traverse
traverseproc tp_traverse;
call function for all accessible objects
- tp_version_tag
uint tp_version_tag;
Type attribute cache version tag. Added in version 2.6
- tp_weaklist
PyObject* tp_weaklist;
- tp_weaklistoffset
Py_ssize_t tp_weaklistoffset;
Type objects contain a string containing the type name (to help somewhat in debugging), the allocation parameters (see PyObject_New() and PyObject_NewVar()), and methods for accessing objects of the type. Methods are optional, a nil pointer meaning that particular kind of access is not available for this type. The Py_DECREF() macro uses the tp_dealloc method without checking for a nil pointer; it should always be implemented except if the implementation can guarantee that the reference count will never reach zero (e.g., for statically allocated type objects).
NB: the methods for certain type groups are now contained in separate method blocks.