Skip to content

[red-knot] Capture backtrace in "check-failed" diagnostic#17641

Merged
MichaReiser merged 3 commits intomainfrom
micha/capture-backtrace
Apr 29, 2025
Merged

[red-knot] Capture backtrace in "check-failed" diagnostic#17641
MichaReiser merged 3 commits intomainfrom
micha/capture-backtrace

Conversation

@MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Apr 26, 2025

Summary

Capture and include the full backtrace in the "check-failed" diagnostic. This also prevents that the default panic handler prints to stdout.

Test Plan

error: panic: Panicked at /Users/micha/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/87bf6b6/src/function/fetch.rs:167:25 when checking `/Users/micha/astral/ecosystem/hydpy/hydpy/auxs/statstools.py`: `dependency graph cycle querying try_metaclass_(Id(23c4b)); set cycle_fn/cycle_initial to fixpoint iterate`
info: This indicates a bug in Red Knot.
info: If you could open an issue at https://github.com/astral-sh/ruff/issues/new?title=%5Bred-knot%5D:%20panic we'd be very appreciative!
info: Platform: macos aarch64
info: Args: ["../../ruff/target/debug/red_knot", "check", "--python", ".venv", "hydpy"]
info: Backtrace:
   0: std::backtrace_rs::backtrace::libunwind::trace
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
   2: std::backtrace::Backtrace::create
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/backtrace.rs:331:13
   3: ruff_db::panic::install_hook::{{closure}}::{{closure}}
             at /Users/micha/astral/ruff/crates/ruff_db/src/panic.rs:59:34
   4: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
...

@MichaReiser MichaReiser changed the title [red-knot] Capture backtrace [red-knot] Capture backtrace in "check-failed" diagnostic Apr 26, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Apr 26, 2025

mypy_primer results

No ecosystem changes detected ✅

@MichaReiser MichaReiser force-pushed the micha/capture-backtrace branch from 00a15d8 to e93f583 Compare April 26, 2025 11:49
@MichaReiser MichaReiser added the ty Multi-file analysis & type inference label Apr 26, 2025
@MichaReiser MichaReiser marked this pull request as ready for review April 26, 2025 11:50
Copy link
Contributor

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

Co-authored-by: David Peter <sharkdp@users.noreply.github.com>
@MichaReiser MichaReiser enabled auto-merge (squash) April 29, 2025 16:55
@MichaReiser MichaReiser merged commit 1d78898 into main Apr 29, 2025
31 checks passed
@MichaReiser MichaReiser deleted the micha/capture-backtrace branch April 29, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants