| 359 | } |
| 360 | |
| 361 | pub fn repr(&self, vm: &VirtualMachine) -> PyResult<PyRef<PyStr>> { |
| 362 | vm.with_recursion("while getting the repr of an object", || { |
| 363 | self.class().slots.repr.load().map_or_else( |
| 364 | || { |
| 365 | Err(vm.new_runtime_error(format!( |
| 366 | "BUG: object of type '{}' has no __repr__ method. This is a bug in RustPython.", |
| 367 | self.class().name() |
| 368 | ))) |
| 369 | }, |
| 370 | |repr| repr(self, vm), |
| 371 | ) |
| 372 | }) |
| 373 | } |
| 374 | |
| 375 | pub fn ascii(&self, vm: &VirtualMachine) -> PyResult<PyRef<PyStr>> { |
| 376 | let repr = self.repr(vm)?; |