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

have PyErr's Debug implementation call traceback.format() #4863

Open
nicolasavru opened this issue Jan 18, 2025 · 1 comment · May be fixed by #4900
Open

have PyErr's Debug implementation call traceback.format() #4863

nicolasavru opened this issue Jan 18, 2025 · 1 comment · May be fixed by #4900

Comments

@nicolasavru
Copy link

Could PyErr's Debug implementation call traceback.format()? Something like .field("traceback", &self.traceback(py).map(|tb| tb.format()))

Err(PyErr { type: <class 'SomeError'>, value: SomeError('some message'), traceback: Some(<traceback object at 0x53e96c8c6300>) }) isn't especially helpful and there doesn't seem to be a convenient way of getting a string (e.g., to pass to a logging library) of a PyErr with a traceback. I could write a function to do that, but it's easy to forget to call a custom function.

nicolasavru added a commit to nicolasavru/pyo3 that referenced this issue Feb 10, 2025
@nicolasavru nicolasavru linked a pull request Feb 10, 2025 that will close this issue
nicolasavru added a commit to nicolasavru/pyo3 that referenced this issue Feb 10, 2025
nicolasavru added a commit to nicolasavru/pyo3 that referenced this issue Feb 10, 2025
@ngoldbaum
Copy link
Contributor

ngoldbaum commented Feb 10, 2025

Sorry no one responded to this. Judging by the improved docstrings in your PR this is worthwhile to do.

nicolasavru added a commit to nicolasavru/pyo3 that referenced this issue Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants