From 67eed53264b93d265ed1d4b136c7ba18076bc1d1 2018-09-18 02:55:05 From: Audrey Dutcher Date: 2018-09-18 02:55:05 Subject: [PATCH] Fix `up` through generators in postmortem debugger By passing the lowest traceback element into the debugger, we require it to use frame.f_back to find older frames. However, f_back is always None for generator frames. By providing a higher-up traceback element, pdb can traverse down the traceback.tb_next links, which do work correctly across generator calls. Furthermore, pdb will not do the right thing if it is provided with a frame/traceback pair that do not correspond to each other - it will duplicate parts of the callstack. Instead, we provide None as a frame, which will cause the debugger to start at the deepest frame, which is the desired behavior here. --- diff --git a/IPython/core/ultratb.py b/IPython/core/ultratb.py index 3b97a82..78a4b3b 100644 --- a/IPython/core/ultratb.py +++ b/IPython/core/ultratb.py @@ -1203,7 +1203,7 @@ class VerboseTB(TBTools): if etb and etb.tb_next: etb = etb.tb_next self.pdb.botframe = etb.tb_frame - self.pdb.interaction(self.tb.tb_frame, self.tb) + self.pdb.interaction(None, etb) if hasattr(self, 'tb'): del self.tb