(cls: PyTypeRef, _nitems: usize, vm: &VirtualMachine)
| 105 | } |
| 106 | |
| 107 | pub(crate) fn generic_alloc(cls: PyTypeRef, _nitems: usize, vm: &VirtualMachine) -> PyResult { |
| 108 | // Only create dict if the class has HAS_DICT flag (i.e., __slots__ was not defined |
| 109 | // or __dict__ is in __slots__) |
| 110 | let dict = if cls |
| 111 | .slots |
| 112 | .flags |
| 113 | .has_feature(crate::types::PyTypeFlags::HAS_DICT) |
| 114 | { |
| 115 | Some(vm.ctx.new_dict()) |
| 116 | } else { |
| 117 | None |
| 118 | }; |
| 119 | Ok(crate::PyRef::new_ref(PyBaseObject, cls, dict).into()) |
| 120 | } |
| 121 | |
| 122 | impl Initializer for PyBaseObject { |
| 123 | type Args = FuncArgs; |
no test coverage detected