Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize backtrace logic? #328

Open
quark-zju opened this issue Dec 15, 2023 · 0 comments
Open

Customize backtrace logic? #328

quark-zju opened this issue Dec 15, 2023 · 0 comments

Comments

@quark-zju
Copy link

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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant