Skip to content

Commit

Permalink
Merge pull request #472 from ccordoba12/fix-debug-magic
Browse files Browse the repository at this point in the history
PR: Add support for chained exceptions to the debugger
  • Loading branch information
ccordoba12 authored Oct 11, 2023
2 parents 3d37912 + 9560f09 commit 072c6cf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion spyder_kernels/customize/spyderpdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,20 +320,32 @@ def interaction(self, frame, traceback):
If this is from sigint, break on the upper frame.
If the frame is in spydercustomize.py, quit.
Notifies spyder and print current code.
"""
if self._pdb_breaking:
self._pdb_breaking = False
if frame and frame.f_back:
return self.interaction(frame.f_back, traceback)

# This is necessary to handle chained exceptions in Pdb, support for
# which was added in IPython 8.15 and will be the default in Python
# 3.13 (see ipython/ipython#14146).
if isinstance(traceback, BaseException):
_chained_exceptions, tb = self._get_tb_and_exceptions(traceback)

with self._hold_exceptions(_chained_exceptions):
self.interaction(frame, tb)

return

self.setup(frame, traceback)
self.print_stack_entry(self.stack[self.curindex])

if self._frontend_notified:
self._cmdloop()
else:
with DebugWrapper(self):
self._cmdloop()

self.forget()

def print_stack_entry(self, frame_lineno, prompt_prefix='\n-> ',
Expand Down

0 comments on commit 072c6cf

Please sign in to comment.