Method
new_class
(
&self,
module: Option<&str>,
name: &str,
base: PyTypeRef,
slots: PyTypeSlots,
)
Source from the content-addressed store, hash-verified
| 590 | } |
| 591 | |
| 592 | pub fn new_class( |
| 593 | &self, |
| 594 | module: Option<&str>, |
| 595 | name: &str, |
| 596 | base: PyTypeRef, |
| 597 | slots: PyTypeSlots, |
| 598 | ) -> PyTypeRef { |
| 599 | let mut attrs = PyAttributes::default(); |
| 600 | if let Some(module) = module { |
| 601 | attrs.insert(identifier!(self, __module__), self.new_str(module).into()); |
| 602 | }; |
| 603 | PyType::new_heap( |
| 604 | name, |
| 605 | vec![base], |
| 606 | attrs, |
| 607 | slots, |
| 608 | self.types.type_type.to_owned(), |
| 609 | self, |
| 610 | ) |
| 611 | .unwrap() |
| 612 | } |
| 613 | |
| 614 | pub fn new_exception_type( |
| 615 | &self, |