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

Function write_traceback_entry

crates/vm/src/exceptions.rs:396–411  ·  view source on GitHub ↗

Print exception occurrence location from traceback element

(
    output: &mut W,
    tb_entry: &Py<PyTraceback>,
)

Source from the content-addressed store, hash-verified

394
395/// Print exception occurrence location from traceback element
396fn write_traceback_entry<W: Write>(
397 output: &mut W,
398 tb_entry: &Py<PyTraceback>,
399) -> Result<(), W::Error> {
400 let filename = tb_entry.frame.code.source_path().as_str();
401 writeln!(
402 output,
403 r##" File "{}", line {}, in {}"##,
404 filename.trim_start_matches(r"\\?\"),
405 tb_entry.lineno,
406 tb_entry.frame.code.obj_name
407 )?;
408 print_source_line(output, filename, tb_entry.lineno.get())?;
409
410 Ok(())
411}
412
413#[derive(Clone)]
414pub enum ExceptionCtor {

Callers 1

write_exception_innerMethod · 0.85

Calls 4

print_source_lineFunction · 0.85
as_strMethod · 0.45
source_pathMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected