Create dynamic ExceptionGroup type with multiple inheritance
(ctx: &Context)
| 15 | |
| 16 | /// Create dynamic ExceptionGroup type with multiple inheritance |
| 17 | fn create_exception_group(ctx: &Context) -> PyRef<PyType> { |
| 18 | let excs = &ctx.exceptions; |
| 19 | let exception_group_slots = PyTypeSlots { |
| 20 | flags: PyTypeFlags::heap_type_flags() | PyTypeFlags::HAS_DICT, |
| 21 | ..Default::default() |
| 22 | }; |
| 23 | PyType::new_heap( |
| 24 | "ExceptionGroup", |
| 25 | vec![ |
| 26 | excs.base_exception_group.to_owned(), |
| 27 | excs.exception_type.to_owned(), |
| 28 | ], |
| 29 | Default::default(), |
| 30 | exception_group_slots, |
| 31 | ctx.types.type_type.to_owned(), |
| 32 | ctx, |
| 33 | ) |
| 34 | .expect("Failed to create ExceptionGroup type with multiple inheritance") |
| 35 | } |
| 36 | |
| 37 | pub fn exception_group() -> &'static Py<PyType> { |
| 38 | ::rustpython_vm::common::static_cell! { |
no test coverage detected