|
|
|
@ -1745,82 +1745,87 @@ _PyTypes_Init(void) |
|
|
|
return status; |
|
|
|
} |
|
|
|
|
|
|
|
#define INIT_TYPE(TYPE, NAME) \ |
|
|
|
#define INIT_TYPE(TYPE) \ |
|
|
|
do { \ |
|
|
|
if (PyType_Ready(TYPE) < 0) { \ |
|
|
|
return _PyStatus_ERR("Can't initialize " NAME " type"); \ |
|
|
|
if (PyType_Ready(&(TYPE)) < 0) { \ |
|
|
|
return _PyStatus_ERR("Can't initialize " #TYPE " type"); \ |
|
|
|
} \ |
|
|
|
} while (0) |
|
|
|
|
|
|
|
INIT_TYPE(&PyBaseObject_Type, "object"); |
|
|
|
INIT_TYPE(&PyType_Type, "type"); |
|
|
|
INIT_TYPE(&_PyWeakref_RefType, "weakref"); |
|
|
|
INIT_TYPE(&_PyWeakref_CallableProxyType, "callable weakref proxy"); |
|
|
|
INIT_TYPE(&_PyWeakref_ProxyType, "weakref proxy"); |
|
|
|
INIT_TYPE(&PyLong_Type, "int"); |
|
|
|
INIT_TYPE(&PyBool_Type, "bool"); |
|
|
|
INIT_TYPE(&PyByteArray_Type, "bytearray"); |
|
|
|
INIT_TYPE(&PyBytes_Type, "str"); |
|
|
|
INIT_TYPE(&PyList_Type, "list"); |
|
|
|
INIT_TYPE(&_PyNone_Type, "None"); |
|
|
|
INIT_TYPE(&_PyNotImplemented_Type, "NotImplemented"); |
|
|
|
INIT_TYPE(&PyTraceBack_Type, "traceback"); |
|
|
|
INIT_TYPE(&PySuper_Type, "super"); |
|
|
|
INIT_TYPE(&PyRange_Type, "range"); |
|
|
|
INIT_TYPE(&PyDict_Type, "dict"); |
|
|
|
INIT_TYPE(&PyDictKeys_Type, "dict keys"); |
|
|
|
INIT_TYPE(&PyDictValues_Type, "dict values"); |
|
|
|
INIT_TYPE(&PyDictItems_Type, "dict items"); |
|
|
|
INIT_TYPE(&PyDictRevIterKey_Type, "reversed dict keys"); |
|
|
|
INIT_TYPE(&PyDictRevIterValue_Type, "reversed dict values"); |
|
|
|
INIT_TYPE(&PyDictRevIterItem_Type, "reversed dict items"); |
|
|
|
INIT_TYPE(&PyODict_Type, "OrderedDict"); |
|
|
|
INIT_TYPE(&PyODictKeys_Type, "odict_keys"); |
|
|
|
INIT_TYPE(&PyODictItems_Type, "odict_items"); |
|
|
|
INIT_TYPE(&PyODictValues_Type, "odict_values"); |
|
|
|
INIT_TYPE(&PyODictIter_Type, "odict_keyiterator"); |
|
|
|
INIT_TYPE(&PySet_Type, "set"); |
|
|
|
INIT_TYPE(&PyUnicode_Type, "str"); |
|
|
|
INIT_TYPE(&PySlice_Type, "slice"); |
|
|
|
INIT_TYPE(&PyStaticMethod_Type, "static method"); |
|
|
|
INIT_TYPE(&PyComplex_Type, "complex"); |
|
|
|
INIT_TYPE(&PyFloat_Type, "float"); |
|
|
|
INIT_TYPE(&PyFrozenSet_Type, "frozenset"); |
|
|
|
INIT_TYPE(&PyProperty_Type, "property"); |
|
|
|
INIT_TYPE(&_PyManagedBuffer_Type, "managed buffer"); |
|
|
|
INIT_TYPE(&PyMemoryView_Type, "memoryview"); |
|
|
|
INIT_TYPE(&PyTuple_Type, "tuple"); |
|
|
|
INIT_TYPE(&PyEnum_Type, "enumerate"); |
|
|
|
INIT_TYPE(&PyReversed_Type, "reversed"); |
|
|
|
INIT_TYPE(&PyStdPrinter_Type, "StdPrinter"); |
|
|
|
INIT_TYPE(&PyCode_Type, "code"); |
|
|
|
INIT_TYPE(&PyFrame_Type, "frame"); |
|
|
|
INIT_TYPE(&PyCFunction_Type, "builtin function"); |
|
|
|
INIT_TYPE(&PyCMethod_Type, "builtin method"); |
|
|
|
INIT_TYPE(&PyMethod_Type, "method"); |
|
|
|
INIT_TYPE(&PyFunction_Type, "function"); |
|
|
|
INIT_TYPE(&PyDictProxy_Type, "dict proxy"); |
|
|
|
INIT_TYPE(&PyGen_Type, "generator"); |
|
|
|
INIT_TYPE(&PyGetSetDescr_Type, "get-set descriptor"); |
|
|
|
INIT_TYPE(&PyWrapperDescr_Type, "wrapper"); |
|
|
|
INIT_TYPE(&_PyMethodWrapper_Type, "method wrapper"); |
|
|
|
INIT_TYPE(&PyEllipsis_Type, "ellipsis"); |
|
|
|
INIT_TYPE(&PyMemberDescr_Type, "member descriptor"); |
|
|
|
INIT_TYPE(&_PyNamespace_Type, "namespace"); |
|
|
|
INIT_TYPE(&PyCapsule_Type, "capsule"); |
|
|
|
INIT_TYPE(&PyLongRangeIter_Type, "long range iterator"); |
|
|
|
INIT_TYPE(&PyCell_Type, "cell"); |
|
|
|
INIT_TYPE(&PyInstanceMethod_Type, "instance method"); |
|
|
|
INIT_TYPE(&PyClassMethodDescr_Type, "class method descr"); |
|
|
|
INIT_TYPE(&PyMethodDescr_Type, "method descr"); |
|
|
|
INIT_TYPE(&PyCallIter_Type, "call iter"); |
|
|
|
INIT_TYPE(&PySeqIter_Type, "sequence iterator"); |
|
|
|
INIT_TYPE(&PyPickleBuffer_Type, "pickle.PickleBuffer"); |
|
|
|
INIT_TYPE(&PyCoro_Type, "coroutine"); |
|
|
|
INIT_TYPE(&_PyCoroWrapper_Type, "coroutine wrapper"); |
|
|
|
INIT_TYPE(&_PyInterpreterID_Type, "interpreter ID"); |
|
|
|
return _PyStatus_OK(); |
|
|
|
// Base types |
|
|
|
INIT_TYPE(PyBaseObject_Type); |
|
|
|
INIT_TYPE(PyType_Type); |
|
|
|
assert(PyBaseObject_Type.tp_base == NULL); |
|
|
|
assert(PyType_Type.tp_base == &PyBaseObject_Type); |
|
|
|
|
|
|
|
// All other static types |
|
|
|
INIT_TYPE(PyBool_Type); |
|
|
|
INIT_TYPE(PyByteArray_Type); |
|
|
|
INIT_TYPE(PyBytes_Type); |
|
|
|
INIT_TYPE(PyCFunction_Type); |
|
|
|
INIT_TYPE(PyCMethod_Type); |
|
|
|
INIT_TYPE(PyCallIter_Type); |
|
|
|
INIT_TYPE(PyCapsule_Type); |
|
|
|
INIT_TYPE(PyCell_Type); |
|
|
|
INIT_TYPE(PyClassMethodDescr_Type); |
|
|
|
INIT_TYPE(PyCode_Type); |
|
|
|
INIT_TYPE(PyComplex_Type); |
|
|
|
INIT_TYPE(PyCoro_Type); |
|
|
|
INIT_TYPE(PyDictItems_Type); |
|
|
|
INIT_TYPE(PyDictKeys_Type); |
|
|
|
INIT_TYPE(PyDictProxy_Type); |
|
|
|
INIT_TYPE(PyDictRevIterItem_Type); |
|
|
|
INIT_TYPE(PyDictRevIterKey_Type); |
|
|
|
INIT_TYPE(PyDictRevIterValue_Type); |
|
|
|
INIT_TYPE(PyDictValues_Type); |
|
|
|
INIT_TYPE(PyDict_Type); |
|
|
|
INIT_TYPE(PyEllipsis_Type); |
|
|
|
INIT_TYPE(PyEnum_Type); |
|
|
|
INIT_TYPE(PyFloat_Type); |
|
|
|
INIT_TYPE(PyFrame_Type); |
|
|
|
INIT_TYPE(PyFrozenSet_Type); |
|
|
|
INIT_TYPE(PyFunction_Type); |
|
|
|
INIT_TYPE(PyGen_Type); |
|
|
|
INIT_TYPE(PyGetSetDescr_Type); |
|
|
|
INIT_TYPE(PyInstanceMethod_Type); |
|
|
|
INIT_TYPE(PyList_Type); |
|
|
|
INIT_TYPE(PyLongRangeIter_Type); |
|
|
|
INIT_TYPE(PyLong_Type); |
|
|
|
INIT_TYPE(PyMemberDescr_Type); |
|
|
|
INIT_TYPE(PyMemoryView_Type); |
|
|
|
INIT_TYPE(PyMethodDescr_Type); |
|
|
|
INIT_TYPE(PyMethod_Type); |
|
|
|
INIT_TYPE(PyODictItems_Type); |
|
|
|
INIT_TYPE(PyODictIter_Type); |
|
|
|
INIT_TYPE(PyODictKeys_Type); |
|
|
|
INIT_TYPE(PyODictValues_Type); |
|
|
|
INIT_TYPE(PyODict_Type); |
|
|
|
INIT_TYPE(PyPickleBuffer_Type); |
|
|
|
INIT_TYPE(PyProperty_Type); |
|
|
|
INIT_TYPE(PyRange_Type); |
|
|
|
INIT_TYPE(PyReversed_Type); |
|
|
|
INIT_TYPE(PySeqIter_Type); |
|
|
|
INIT_TYPE(PySet_Type); |
|
|
|
INIT_TYPE(PySlice_Type); |
|
|
|
INIT_TYPE(PyStaticMethod_Type); |
|
|
|
INIT_TYPE(PyStdPrinter_Type); |
|
|
|
INIT_TYPE(PySuper_Type); |
|
|
|
INIT_TYPE(PyTraceBack_Type); |
|
|
|
INIT_TYPE(PyTuple_Type); |
|
|
|
INIT_TYPE(PyUnicode_Type); |
|
|
|
INIT_TYPE(PyWrapperDescr_Type); |
|
|
|
INIT_TYPE(_PyCoroWrapper_Type); |
|
|
|
INIT_TYPE(_PyInterpreterID_Type); |
|
|
|
INIT_TYPE(_PyManagedBuffer_Type); |
|
|
|
INIT_TYPE(_PyMethodWrapper_Type); |
|
|
|
INIT_TYPE(_PyNamespace_Type); |
|
|
|
INIT_TYPE(_PyNone_Type); |
|
|
|
INIT_TYPE(_PyNotImplemented_Type); |
|
|
|
INIT_TYPE(_PyWeakref_CallableProxyType); |
|
|
|
INIT_TYPE(_PyWeakref_ProxyType); |
|
|
|
INIT_TYPE(_PyWeakref_RefType); |
|
|
|
|
|
|
|
return _PyStatus_OK(); |
|
|
|
#undef INIT_TYPE |
|
|
|
} |
|
|
|
|
|
|
|
|