From 15aaa7f09de69106164eb7dbc32e19ce424c12a4 2020-10-23 00:26:07 From: Matthias Bussonnier Date: 2020-10-23 00:26:07 Subject: [PATCH] Merge pull request #12659 from impact27/patch-9 Fix settrace for recursive debugger --- diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py index 928a898..58d2c30 100644 --- a/IPython/core/debugger.py +++ b/IPython/core/debugger.py @@ -595,6 +595,7 @@ class Pdb(OldPdb): argument (which is an arbitrary expression or statement to be executed in the current environment). """ + trace_function = sys.gettrace() sys.settrace(None) globals = self.curframe.f_globals locals = self.curframe_locals @@ -605,7 +606,7 @@ class Pdb(OldPdb): self.message("ENTERING RECURSIVE DEBUGGER") sys.call_tracing(p.run, (arg, globals, locals)) self.message("LEAVING RECURSIVE DEBUGGER") - sys.settrace(self.trace_dispatch) + sys.settrace(trace_function) self.lastcmd = p.lastcmd def do_pdef(self, arg):