fn print_traceback_entry<W: Write>(
    mut output: W,
    vm: &VirtualMachine,
    tb_entry: &PyObjectRef,
) -> io::Result<()> {
    if objtype::isinstance(&tb_entry, &vm.ctx.tuple_type()) {
        let location_attrs = objsequence::get_elements_tuple(&tb_entry);

        let filename = vm.to_str(&location_attrs[0]);
        let filename = if let Ok(ref x) = filename {
            x.as_str()
        } else {
            "<error>"
        };

        let lineno = vm.to_str(&location_attrs[1]);
        let lineno = if let Ok(ref x) = lineno {
            x.as_str()
        } else {
            "<error>"
        };

        let obj_name = vm.to_str(&location_attrs[2]);
        let obj_name = if let Ok(ref x) = obj_name {
            x.as_str()
        } else {
            "<error>"
        };

        writeln!(
            output,
            r##"  File "{}", line {}, in {}"##,
            filename, lineno, obj_name
        )?;
        print_source_line(output, filename, lineno.parse().unwrap())?;
    } else {
        writeln!(output, "  File ??")?;
    }
    Ok(())
}
/// Print exception occurrence location from traceback element
Print exception occurrence location from traceback element
Print exception occurrence location from traceback element
fn print_traceback_entry<W: Write>(
    mut output: W,
    vm: &VirtualMachine,
    tb_entry: &PyObjectRef,
) -> io::Result<()> {
    if objtype::isinstance(&tb_entry, &vm.ctx.tuple_type()) {
        let location_attrs = objsequence::get_elements_tuple(&tb_entry);
        let filename = vm.to_str(&location_attrs[0]);
        let filename = if let Ok(ref x) = filename {
            x.as_str()
        } else {
            "<error>"
        };
        let lineno = vm.to_str(&location_attrs[1]);
        let lineno = if let Ok(ref x) = lineno {
            x.as_str()
        } else {
            "<error>"
        };
        let obj_name = vm.to_str(&location_attrs[2]);
        let obj_name = if let Ok(ref x) = obj_name {
            x.as_str()
        } else {
            "<error>"
        };
        writeln!(
            output,
            r##"  File "{}", line {}, in {}"##,
            filename, lineno, obj_name
        )?;
        print_source_line(output, filename, lineno.parse().unwrap())?;
    } else {
        writeln!(output, "  File ??")?;
    }
    Ok(())
}
fn print_traceback_entry < W : Write > ( mut output : W , vm : & VirtualMachine , tb_entry : & PyObjectRef , ) -> io :: Result < ( ) > { if objtype :: isinstance ( & tb_entry , & vm . ctx . tuple_type ( ) ) { let location_attrs = objsequence :: get_elements_tuple ( & tb_entry ) ; let filename = vm . to_str ( & location_attrs [ 0 ] ) ; let filename = if let Ok ( ref x ) = filename { x . as_str ( ) } else { " " } ; let lineno = vm . to_str ( & location_attrs [ 1 ] ) ; let lineno = if let Ok ( ref x ) = lineno { x . as_str ( ) } else { " " } ; let obj_name = vm . to_str ( & location_attrs [ 2 ] ) ; let obj_name = if let Ok ( ref x ) = obj_name { x . as_str ( ) } else { " " } ; writeln ! ( output r##"  File "{}", line {}, in {}"## filename lineno obj_name ) ? ; print_source_line ( output , filename , lineno . parse ( ) . unwrap ( ) ) ? ; } else { writeln ! ( output " " ) ? ; } Ok ( ( ) ) }
Print exception occurrence location from traceback element
Print exception occurrence location from traceback element
output
W
vm
&VirtualMachine
tb_entry
&PyObjectRef