Unraiseable traceback by youknowone · Pull Request #6449 · RustPython/RustPython
Caution
Review failed
The pull request is closed.
Walkthrough
Updated the sys module's unraisable-exception hook: prints traceback via exc_traceback using Python's traceback.print_tb, improves exception type and value formatting (module name, qualname, surrogate-safe value), adds colon/newline formatting and stderr flush, and adds KwArgs to imported function types.
Changes
| Cohort / File(s) | Summary |
|---|---|
Unraisable exception hook & imports crates/vm/src/stdlib/sys.rs |
Added KwArgs to function imports; implemented real traceback printing using exc_traceback and traceback.print_tb; enhanced exception type printing (module name filtering, qualname fallback), improved exception value formatting with surrogate-safe fallback, ensured colon and trailing newline in message, and flushed stderr after printing. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
- Inspect
exc_tracebackNone handling and call totraceback.print_tb. - Verify module name filtering logic for builtins and
__main__. - Confirm qualname fallback and surrogate-safe
str()fallback behave correctly. - Ensure stderr flush occurs after all writes.
Possibly related PRs
- Unraiseable traceback #6449 — Similar modifications to
crates/vm/src/stdlib/sys.rsaddingKwArgsand improving unraisable traceback printing and formatting.
Poem
🐰 I hopped through code, found traces to show,
A traceback now prints where silent errors go.
Module names, qualnames, each line in its place,
A flushed little message, tidy and ace.
Hooray — the hook sings, and I twitch my nose.
Pre-merge checks and finishing touches
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title directly corresponds to the main change: implementing unraisable exception traceback printing functionality in the sys module. |
📜 Recent review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
crates/vm/src/stdlib/sys.rs(2 hunks)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.