(args: DumpTracebackArgs, vm: &VirtualMachine)
| 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))] |
nothing calls this directly
no test coverage detected