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

Method __str__

crates/vm/src/exceptions.rs:668–675  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

666impl Py<PyBaseException> {
667 #[pymethod]
668 pub(super) fn __str__(&self, vm: &VirtualMachine) -> PyResult<PyStrRef> {
669 let str_args = vm.exception_args_as_string(self.args(), true);
670 Ok(match str_args.into_iter().exactly_one() {
671 Err(i) if i.len() == 0 => vm.ctx.empty_str.to_owned(),
672 Ok(s) => s,
673 Err(i) => PyStr::from(format!("({})", i.format(", "))).into_ref(&vm.ctx),
674 })
675 }
676}
677
678#[pyclass]

Callers

nothing calls this directly

Calls 15

okMethod · 0.80
to_stringMethod · 0.80
str_utf8Method · 0.80
try_into_valueMethod · 0.80
code_pointsMethod · 0.80
argsMethod · 0.45
into_iterMethod · 0.45
lenMethod · 0.45
to_ownedMethod · 0.45
into_refMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected