Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b2f6e85

Browse files
committed
Adresse secodn round of review
1 parent dbd0b7b commit b2f6e85

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

Doc/library/pdb.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,13 +639,15 @@ can be overridden by the local file.
639639

640640
Print the return value for the last return of the current function.
641641

642-
.. pdbcommand:: exceptions [arg]
642+
.. pdbcommand:: exceptions [excnumber]
643643

644644
List or jump between chained exceptions.
645645

646-
If ``Pdb.post_mortem()`` is called with a chained exception, it will now allow
647-
the user to move between the chained exceptions using ``exceptions`` command to
648-
list exceptions, and ``exception <number>`` to switch to that exception.
646+
When using ``pdb.pm()`` or ``Pdb.post_mortem(...)`` with a chained exception
647+
instead of a traceback, it will now allow the user to move between the
648+
chained exceptions using ``exceptions`` command to list exceptions, and
649+
``exception <number>`` to switch to that exception.
650+
649651

650652
Example::
651653

Lib/pdb.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,11 @@ def preloop(self):
416416
self.message('display %s: %r [old: %r]' %
417417
(expr, newvalue, oldvalue))
418418

419-
def interaction(self, frame, traceback):
419+
def interaction(self, frame, tb_or_exc):
420420
# Restore the previous signal handler at the Pdb prompt.
421421

422-
if isinstance(traceback, BaseException):
423-
traceback, exception = traceback.__traceback__, traceback
422+
if isinstance(tb_or_exc, BaseException):
423+
tb_or_exc, exception = tb_or_exc.__traceback__, tb_or_exc
424424
self._chained_exceptions = [exception]
425425
current = exception
426426
while current := current.__context__:
@@ -436,7 +436,7 @@ def interaction(self, frame, traceback):
436436
pass
437437
else:
438438
Pdb._previous_sigint_handler = None
439-
if self.setup(frame, traceback):
439+
if self.setup(frame, tb_or_exc):
440440
# no interaction desired at this time (happens if .pdbrc contains
441441
# a command like "continue")
442442
self.forget()
@@ -1087,7 +1087,7 @@ def _select_frame(self, number):
10871087
self.lineno = None
10881088

10891089
def do_exceptions(self, arg):
1090-
if not arg or arg == "list":
1090+
if not arg:
10911091
for ix, exc in enumerate(self._chained_exceptions):
10921092
prompt = ">" if ix == self._chained_exception_index else " "
10931093
self.message(f"{prompt} {ix} {exc!r}")

0 commit comments

Comments
 (0)