From 6b1960d811d25e8f754324259a5b4fd59f8f8162 2016-10-25 12:36:39 From: Thomas Kluyver Date: 2016-10-25 12:36:39 Subject: [PATCH] Remove debugger curframe attribute before using checkline() Closes gh-10028 --- diff --git a/IPython/core/magics/execution.py b/IPython/core/magics/execution.py index 36a3645..78a0372 100644 --- a/IPython/core/magics/execution.py +++ b/IPython/core/magics/execution.py @@ -816,6 +816,11 @@ python-profiler package from non-free.""") self.shell.InteractiveTB.pdb = self.shell.InteractiveTB.debugger_cls() deb = self.shell.InteractiveTB.pdb + # deb.checkline() fails if deb.curframe exists but is None; it can + # handle it not existing. https://github.com/ipython/ipython/issues/10028 + if hasattr(deb, 'curframe'): + del deb.curframe + # reset Breakpoint state, which is moronically kept # in a class bdb.Breakpoint.next = 1