def setup(self, f, tb):
if tb is not None:
return pdb.Pdb.setup(self, f, tb)
else:
# Imitate what the parent function is doing as much as possible,
# but without a traceback
self.forget()
self.stack, self.curindex = self.get_stack(f, tb)
# XXX We may still need to reproduce the following lines:
"""
while tb:
# when setting up post-mortem debugging with a traceback, save all
# the original line numbers to be displayed along the current line
# numbers (which can be different, e.g. due to finally clauses)
lineno = lasti2lineno(tb.tb_frame.f_code, tb.tb_lasti)
self.tb_lineno[tb.tb_frame] = lineno
tb = tb.tb_next
"""
self.curframe = self.stack[self.curindex][0]
# The f_locals dictionary is updated from the actual frame
# locals whenever the .f_locals accessor is called, so we
# cache it here to ensure that modifications are not overwritten.
self.curframe_locals = self.curframe.f_locals
return self.execRcLines()
评论列表
文章目录