(zelf: &Py<Self>, vm: &VirtualMachine)
| 442 | impl Representable for PyModule { |
| 443 | #[inline] |
| 444 | fn repr(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyStrRef> { |
| 445 | // Use cached importlib reference (like interp->importlib) |
| 446 | let module_repr = vm.importlib.get_attr("_module_repr", vm)?; |
| 447 | let repr = module_repr.call((zelf.to_owned(),), vm)?; |
| 448 | repr.downcast() |
| 449 | .map_err(|_| vm.new_type_error("_module_repr did not return a string")) |
| 450 | } |
| 451 | |
| 452 | #[cold] |
| 453 | fn repr_str(_zelf: &Py<Self>, _vm: &VirtualMachine) -> PyResult<String> { |