Skip to content

Conversation

@davidhewitt
Copy link
Member

@davidhewitt davidhewitt commented Nov 10, 2021

Adds PyTraceback type, with a .format() method to stringify the traceback object.

Closes #592

This changes PyErr::ptraceback() to return Option<&PyTraceback> instead of Option<&PyAny>, but I don't think this is breaking as &PyTraceback will coerce to &PyAny.

@birkenfeld
Copy link
Member

This is totally a bikeshed, but the TraceBack capitalization looks funny to me. Unfortunately CPython uses both TraceBack and Traceback, so there's no good example to follow.

@davidhewitt davidhewitt changed the title types: add PyTraceBack types: add PyTraceback Nov 10, 2021
@davidhewitt
Copy link
Member Author

👍 agreed, I was on the fence about this as I also thought PyTraceBack looked a bit clunky. Changed to PyTraceback.

@davidhewitt
Copy link
Member Author

I'll probably merge this early next week if there's no further concerns from anyone.

@davidhewitt davidhewitt merged commit 9ae7e31 into PyO3:main Nov 15, 2021
@davidhewitt davidhewitt deleted the traceback-type branch November 15, 2021 09:04
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

Successfully merging this pull request may close these issues.

pretty python exception traceback in rust

2 participants