-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-113081: Print colorized exception just like built-in traceback in pdb #113082
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
Conversation
@pablogsal could you share some thoughts on this? Do you think we need extra tests for pdb? Thanks! |
@pablogsal, any thoughts on this simple (colorful!) change? Otherwise I'm inclined to merge. :) |
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
What is the current proper way to disable color in tests? I thought there was a global mechanism implemented. I can do it for pdb only but want to make sure this is not something that should be covered already. |
Check out |
Looks like |
Okay seems like the tests passed now. My local tests worked fine and I did not have the time to figure out the difference. |
Let's merge it! |
This is the first step to colorize pdb - just use the existing colorized traceback for exceptions in post mortem mode. The code change is really trivial and it just calls the colorized version of exception printing in traceback.
Yes, it's using an internal function, but
pdb
is stdlib so it can adapt when the function is changed. We can also useprint_exception
but we needtraceback._can_colorize()
anyway - which should be put into a separate module if we want to colorize more modules.