MCPcopy Index your code
hub / github.com/RustPython/RustPython / repr

Method repr

crates/vm/src/protocol/object.rs:361–373  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

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)?;

Callers 3

repr_utf8Method · 0.45
asciiMethod · 0.45
strMethod · 0.45

Calls 5

reprFunction · 0.85
with_recursionMethod · 0.80
ErrClass · 0.50
loadMethod · 0.45
classMethod · 0.45

Tested by

no test coverage detected