Customize backtrace logic?
- Dominant language
- Rust
- Stars
- 6.7k
- Forks
- 224
- PR merge metrics
- No merged PRs in 30d
Description
In a Rust / Python program, the Rust backtrace might contain `PyEval_EvalFrameEx` frames. It indicates Python is involved, but not which Python function. It'd be nice to be able to annotate those `PyEval_EvalFrameEx` frames with the actual Python function names.
By allowing a customized "backtrace" logic, such Python / Rust application might:
- Use [PEP 523](https://peps.python.org/pep-0523/) to insert a custom `PyEval_EvalFrameEx` wrapper that tracks what native frames associate with what Python functions.
- Provide a Rust `backtrace` wrapper that translates native frames back to Python functions using the above information.
- Register the customized `backtrace` logic to `anyhow`.
This might be alternatively implemented by not changing `anyhow` but updating the "display" logic to look at the `Error::backtrace` and do some post-processing. But that might be annoying if there are deeply nested errors, and `backtrace` is only available in some cases.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.