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

Function repr_wrapper

crates/vm/src/types/slot.rs:466–474  ·  view source on GitHub ↗
(zelf: &PyObject, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

464}
465
466fn repr_wrapper(zelf: &PyObject, vm: &VirtualMachine) -> PyResult<PyRef<PyStr>> {
467 let ret = vm.call_special_method(zelf, identifier!(vm, __repr__), ())?;
468 ret.downcast::<PyStr>().map_err(|obj| {
469 vm.new_type_error(format!(
470 "__repr__ returned non-string (type {})",
471 obj.class()
472 ))
473 })
474}
475
476fn str_wrapper(zelf: &PyObject, vm: &VirtualMachine) -> PyResult<PyRef<PyStr>> {
477 let ret = vm.call_special_method(zelf, identifier!(vm, __str__), ())?;

Callers

nothing calls this directly

Calls 1

call_special_methodMethod · 0.80

Tested by

no test coverage detected