1 typedef struct _typeobject
{
3 char *tp_name
; /* For printing, in format "<module>.<name>" */
4 int tp_basicsize
, tp_itemsize
; /* For allocation */
6 /* Methods to implement standard operations */
10 getattrfunc tp_getattr
;
11 setattrfunc tp_setattr
;
15 /* Method suites for standard classes */
17 PyNumberMethods
*tp_as_number
;
18 PySequenceMethods
*tp_as_sequence
;
19 PyMappingMethods
*tp_as_mapping
;
21 /* More standard operations (here for binary compatibility) */
26 getattrofunc tp_getattro
;
27 setattrofunc tp_setattro
;
29 /* Functions to access object as input/output buffer */
30 PyBufferProcs
*tp_as_buffer
;
32 /* Flags to define presence of optional/expanded features */
35 char *tp_doc
; /* Documentation string */
37 /* Assigned meaning in release 2.0 */
38 /* call function for all accessible objects */
39 traverseproc tp_traverse
;
41 /* delete references to contained objects */
44 /* Assigned meaning in release 2.1 */
45 /* rich comparisons */
46 richcmpfunc tp_richcompare
;
48 /* weak reference enabler */
49 long tp_weaklistoffset
;
51 /* Added in release 2.2 */
54 iternextfunc tp_iternext
;
56 /* Attribute descriptor and subclassing stuff */
57 struct PyMethodDef
*tp_methods
;
58 struct PyMemberDef
*tp_members
;
59 struct PyGetSetDef
*tp_getset
;
60 struct _typeobject
*tp_base
;
62 descrgetfunc tp_descr_get
;
63 descrsetfunc tp_descr_set
;
68 freefunc tp_free
; /* Low-level free-memory routine */
69 inquiry tp_is_gc
; /* For PyObject_IS_GC */
71 PyObject
*tp_mro
; /* method resolution order */
73 PyObject
*tp_subclasses
;
74 PyObject
*tp_weaklist
;