##// END OF EJS Templates
Fix case where some Exceptions have no traceback....
Matthias Bussonnier -
Show More
@@ -419,7 +419,12 b' class Pdb(OldPdb):'
419 419 rep = repr(exc)
420 420 if len(rep) > 80:
421 421 rep = rep[:77] + "..."
422 self.message(f"{prompt} {ix:>3} {rep}")
422 indicator = (
423 " -"
424 if self._chained_exceptions[ix].__traceback__ is None
425 else f"{ix:>3}"
426 )
427 self.message(f"{prompt} {indicator} {rep}")
423 428 else:
424 429 try:
425 430 number = int(arg)
@@ -427,6 +432,12 b' class Pdb(OldPdb):'
427 432 self.error("Argument must be an integer")
428 433 return
429 434 if 0 <= number < len(self._chained_exceptions):
435 if self._chained_exceptions[number].__traceback__ is None:
436 self.error(
437 "This exception does not have a traceback, cannot jump to it"
438 )
439 return
440
430 441 self._chained_exception_index = number
431 442 self.setup(None, self._chained_exceptions[number].__traceback__)
432 443 self.print_stack_entry(self.stack[self.curindex])
@@ -438,6 +449,8 b' class Pdb(OldPdb):'
438 449 if CHAIN_EXCEPTIONS:
439 450 # this context manager is part of interaction in 3.13
440 451 _chained_exceptions, tb = self._get_tb_and_exceptions(tb_or_exc)
452 if isinstance(tb_or_exc, BaseException):
453 assert tb is not None, "main exception must have a traceback"
441 454 with self._hold_exceptions(_chained_exceptions):
442 455 OldPdb.interaction(self, frame, tb)
443 456 else:
General Comments 0
You need to be logged in to leave comments. Login now