Home | History | Annotate | Download | only in framer
      1 """Descriptions of all the slots in Python's type objects."""
      2 
      3 class Slot(object):
      4     def __init__(self, name, cast=None, special=None, default="0"):
      5         self.name = name
      6         self.cast = cast
      7         self.special = special
      8         self.default = default
      9 
     10 Slots = (Slot("ob_size"),
     11          Slot("tp_name"),
     12          Slot("tp_basicsize"),
     13          Slot("tp_itemsize"),
     14          Slot("tp_dealloc", "destructor"),
     15          Slot("tp_print", "printfunc"),
     16          Slot("tp_getattr", "getattrfunc"),
     17          Slot("tp_setattr", "setattrfunc"),
     18          Slot("tp_compare", "cmpfunc", "__cmp__"),
     19          Slot("tp_repr", "reprfunc", "__repr__"),
     20          Slot("tp_as_number"),
     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__"),
     29          Slot("tp_as_buffer"),
     30          Slot("tp_flags", default="Py_TPFLAGS_DEFAULT"),
     31          Slot("tp_doc"),
     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
     38          Slot("tp_methods"),
     39          Slot("tp_members"),
     40          Slot("tp_getset"),
     41          Slot("tp_base"),
     42          Slot("tp_dict"),
     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"),
     51          Slot("tp_bases"),
     52          Slot("tp_mro"),
     53          Slot("tp_cache"),
     54          Slot("tp_subclasses"),
     55          Slot("tp_weaklist"),
     56          )
     57 
     58 # give some slots symbolic names
     59 TP_NAME = Slots[1]
     60 TP_BASICSIZE = Slots[2]
     61 TP_DEALLOC = Slots[4]
     62 TP_DOC = Slots[20]
     63 TP_METHODS = Slots[27]
     64 TP_MEMBERS = Slots[28]
     65