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

Function dump_traceback

crates/stdlib/src/faulthandler.rs:377–400  ·  view source on GitHub ↗
(args: DumpTracebackArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

375
376 #[pyfunction]
377 fn dump_traceback(args: DumpTracebackArgs, vm: &VirtualMachine) -> PyResult<()> {
378 let fd = get_fd_from_file_opt(args.file, vm)?;
379
380 #[cfg(any(unix, windows))]
381 {
382 if args.all_threads {
383 dump_all_threads(fd, vm);
384 } else {
385 puts(fd, "Stack (most recent call first):\n");
386 let frames = vm.frames.borrow();
387 for fp in frames.iter().rev() {
388 // SAFETY: the frame is alive while it's in the Vec
389 dump_frame_from_ref(fd, unsafe { fp.as_ref() });
390 }
391 }
392 }
393
394 #[cfg(not(any(unix, windows)))]
395 {
396 let _ = (fd, args.all_threads);
397 }
398
399 Ok(())
400 }
401
402 /// Dump tracebacks of all threads.
403 #[cfg(any(unix, windows))]

Callers

nothing calls this directly

Calls 8

get_fd_from_file_optFunction · 0.85
dump_all_threadsFunction · 0.85
putsFunction · 0.85
dump_frame_from_refFunction · 0.85
borrowMethod · 0.45
revMethod · 0.45
iterMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected