1
"""Descriptions of all the slots in Python's type objects."""
4
def __init__(self, name, cast=None, special=None, default="0"):
10
Slots = (Slot("ob_size"),
14
Slot("tp_dealloc", "destructor"),
15
Slot("tp_print", "printfunc"),
16
Slot("tp_getattr", "getattrfunc"),
17
Slot("tp_setattr", "setattrfunc"),
18
Slot("tp_reserved", "void*"),
19
Slot("tp_repr", "reprfunc", "__repr__"),
21
Slot("tp_as_sequence"),
22
Slot("tp_as_mapping"),
23
Slot("tp_hash", "hashfunc", "__hash__"),
24
Slot("tp_call", "ternaryfunc", "__call__"),
25
Slot("tp_str", "reprfunc", "__str__"),
26
Slot("tp_getattro", "getattrofunc", "__getattr__", # XXX
27
"PyObject_GenericGetAttr"),
28
Slot("tp_setattro", "setattrofunc", "__setattr__"),
30
Slot("tp_flags", default="Py_TPFLAGS_DEFAULT"),
32
Slot("tp_traverse", "traverseprox"),
33
Slot("tp_clear", "inquiry"),
34
Slot("tp_richcompare", "richcmpfunc"),
35
Slot("tp_weaklistoffset"),
36
Slot("tp_iter", "getiterfunc", "__iter__"),
37
Slot("tp_iternext", "iternextfunc", "__next__"), # XXX
43
Slot("tp_descr_get", "descrgetfunc"),
44
Slot("tp_descr_set", "descrsetfunc"),
45
Slot("tp_dictoffset"),
46
Slot("tp_init", "initproc", "__init__"),
47
Slot("tp_alloc", "allocfunc"),
48
Slot("tp_new", "newfunc"),
49
Slot("tp_free", "freefunc"),
50
Slot("tp_is_gc", "inquiry"),
54
Slot("tp_subclasses"),
58
# give some slots symbolic names
60
TP_BASICSIZE = Slots[2]
63
TP_METHODS = Slots[27]
64
TP_MEMBERS = Slots[28]