[svn r59268] An improvement to pdb (which I should also propose as a CPython patch):

in post_portem, the "up" command isn't normally able to walk up past
generator frames.  This fixes it.

--HG--
branch : trunk
This commit is contained in:
arigo 2008-10-20 15:45:10 +02:00
parent 4e3d14162d
commit 5425dba4e5
1 changed files with 10 additions and 4 deletions

View File

@ -56,13 +56,19 @@ class Pdb(pdb.Pdb):
return None
return linecache.getline(filename, lineno)
def get_stack(self, f, t):
# Modified from bdb.py to be able to walk the stack beyond generators,
# which does not work in the normal pdb :-(
stack, i = pdb.Pdb.get_stack(self, f, t)
if f is None:
i = max(0, len(stack) - 1)
return stack, i
def post_mortem(t):
# again, a copy of the version in pdb.py
# modified from pdb.py for the new get_stack() implementation
p = Pdb()
p.reset()
while t.tb_next is not None:
t = t.tb_next
p.interaction(t.tb_frame, t)
p.interaction(None, t)
def set_trace():
# again, a copy of the version in pdb.py