()
| 109 | impl TypeZoo { |
| 110 | #[cold] |
| 111 | pub(crate) fn init() -> Self { |
| 112 | let (type_type, object_type, weakref_type) = crate::object::init_type_hierarchy(); |
| 113 | // the order matters for type, object, weakref, and int - must be initialized first |
| 114 | let type_type = type_::PyType::init_manually(type_type); |
| 115 | let object_type = object::PyBaseObject::init_manually(object_type); |
| 116 | let weakref_type = weakref::PyWeak::init_manually(weakref_type); |
| 117 | let int_type = int::PyInt::init_builtin_type(); |
| 118 | |
| 119 | // builtin_function_or_method and builtin_method share the same type (CPython behavior) |
| 120 | let builtin_function_or_method_type = builtin_func::PyNativeFunction::init_builtin_type(); |
| 121 | |
| 122 | Self { |
| 123 | type_type, |
| 124 | object_type, |
| 125 | weakref_type, |
| 126 | int_type, |
| 127 | |
| 128 | // types exposed as builtins |
| 129 | bool_type: bool_::PyBool::init_builtin_type(), |
| 130 | bytearray_type: bytearray::PyByteArray::init_builtin_type(), |
| 131 | bytes_type: bytes::PyBytes::init_builtin_type(), |
| 132 | classmethod_type: classmethod::PyClassMethod::init_builtin_type(), |
| 133 | complex_type: complex::PyComplex::init_builtin_type(), |
| 134 | dict_type: dict::PyDict::init_builtin_type(), |
| 135 | enumerate_type: enumerate::PyEnumerate::init_builtin_type(), |
| 136 | float_type: float::PyFloat::init_builtin_type(), |
| 137 | frozenset_type: set::PyFrozenSet::init_builtin_type(), |
| 138 | filter_type: filter::PyFilter::init_builtin_type(), |
| 139 | list_type: list::PyList::init_builtin_type(), |
| 140 | map_type: map::PyMap::init_builtin_type(), |
| 141 | memoryview_type: memory::PyMemoryView::init_builtin_type(), |
| 142 | property_type: property::PyProperty::init_builtin_type(), |
| 143 | range_type: range::PyRange::init_builtin_type(), |
| 144 | set_type: set::PySet::init_builtin_type(), |
| 145 | slice_type: slice::PySlice::init_builtin_type(), |
| 146 | staticmethod_type: staticmethod::PyStaticMethod::init_builtin_type(), |
| 147 | str_type: pystr::PyStr::init_builtin_type(), |
| 148 | super_type: super_::PySuper::init_builtin_type(), |
| 149 | tuple_type: tuple::PyTuple::init_builtin_type(), |
| 150 | zip_type: zip::PyZip::init_builtin_type(), |
| 151 | |
| 152 | // hidden internal types. is this really need to be cached here? |
| 153 | async_generator: asyncgenerator::PyAsyncGen::init_builtin_type(), |
| 154 | async_generator_asend: asyncgenerator::PyAsyncGenASend::init_builtin_type(), |
| 155 | async_generator_athrow: asyncgenerator::PyAsyncGenAThrow::init_builtin_type(), |
| 156 | async_generator_wrapped_value: |
| 157 | asyncgenerator::PyAsyncGenWrappedValue::init_builtin_type(), |
| 158 | anext_awaitable: asyncgenerator::PyAnextAwaitable::init_builtin_type(), |
| 159 | bound_method_type: function::PyBoundMethod::init_builtin_type(), |
| 160 | builtin_function_or_method_type, |
| 161 | builtin_method_type: builtin_function_or_method_type, |
| 162 | bytearray_iterator_type: bytearray::PyByteArrayIterator::init_builtin_type(), |
| 163 | bytes_iterator_type: bytes::PyBytesIterator::init_builtin_type(), |
| 164 | callable_iterator: iter::PyCallableIterator::init_builtin_type(), |
| 165 | capsule_type: capsule::PyCapsule::init_builtin_type(), |
| 166 | cell_type: function::PyCell::init_builtin_type(), |
| 167 | code_type: code::PyCode::init_builtin_type(), |
| 168 | coroutine_type: coroutine::PyCoroutine::init_builtin_type(), |
no test coverage detected