| 1132 | } |
| 1133 | |
| 1134 | pub fn get_attributes(&self) -> PyAttributes { |
| 1135 | // Gather all members here: |
| 1136 | let mut attributes = PyAttributes::default(); |
| 1137 | |
| 1138 | // mro[0] is self, so we iterate through the entire MRO in reverse |
| 1139 | for bc in self.mro.read().iter().map(|cls| -> &Self { cls }).rev() { |
| 1140 | for (name, value) in bc.attributes.read().iter() { |
| 1141 | attributes.insert(name.to_owned(), value.clone()); |
| 1142 | } |
| 1143 | } |
| 1144 | |
| 1145 | attributes |
| 1146 | } |
| 1147 | |
| 1148 | // bound method for every type |
| 1149 | pub(crate) fn __new__(zelf: PyRef<Self>, args: FuncArgs, vm: &VirtualMachine) -> PyResult { |