Repository navigation
gh-106670: Allow Pdb to move between chained exceptions - #106676
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow Pdb to move between chained exception.
This lets Pdb receive an exception, instead of a traceback, and when
this is the case and the exception are chained, the new
exceptionscommandallows to both list (no arguments) and move between the chained exceptions.
That is to say if you have something like
Only A was reachable after calling
out()and doing post mortem debug.With this all A-E points are reachable with a combination of up/down,
and
exceptions <number>.This also change the default behavior of
pdb.pm(), as well aspython -m pdb <script.py>to receivesys.last_excso that chainedexception navigation is enabled.
We do follow the logic of the
tracebackmodule and handle the_context__and__cause__in the same way. That is to say, we try__cause__first, and if not present chain with__context__. Inthe same vein, if we encounter an exception that has
__suppress_context__(like whenraise ... from None), we do stopwalking the chain.
Some implementation notes:
forget(), assetup()andforget()are both for setting a singleexception.
context manager.
maximum number we allow
Closes gh-106670