From 3cb2535d31fca98f12b8dbeba2775fc4692ba985 2020-10-23 15:45:24 From: Matthias Bussonnier Date: 2020-10-23 15:45:24 Subject: [PATCH] Merge pull request #12667 from meeseeksmachine/auto-backport-of-pr-12659-on-7.x --- diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py index 4a311c2..94eebb6 100644 --- a/IPython/core/debugger.py +++ b/IPython/core/debugger.py @@ -597,6 +597,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 @@ -607,7 +608,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):