]> granicus.if.org Git - python/commitdiff
fix #4150: pdb's up command didn't work for generators in post-mortem
authorBenjamin Peterson <benjamin@python.org>
Wed, 22 Oct 2008 21:16:34 +0000 (21:16 +0000)
committerBenjamin Peterson <benjamin@python.org>
Wed, 22 Oct 2008 21:16:34 +0000 (21:16 +0000)
Lib/bdb.py
Lib/pdb.py
Misc/NEWS

index d74415bf14771fd29777e7ece80654777d4552a6..5288cc0d77b3fff578e0312df2922fe926db43bf 100644 (file)
@@ -320,6 +320,8 @@ class Bdb:
         while t is not None:
             stack.append((t.tb_frame, t.tb_lineno))
             t = t.tb_next
+        if f is None:
+            i = max(0, len(stack) - 1)
         return stack, i
 
     #
index a7a3a18befaf0d188949c0920dfb47c9c7810e7d..4a080c73c339fcd199c70d875aed961a36ad0392 100755 (executable)
@@ -1224,9 +1224,7 @@ def post_mortem(t=None):
 
     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 pm():
     post_mortem(sys.last_traceback)
@@ -1289,9 +1287,7 @@ def main():
             print "Uncaught exception. Entering post mortem debugging"
             print "Running 'cont' or 'step' will restart the program"
             t = sys.exc_info()[2]
-            while t.tb_next is not None:
-                t = t.tb_next
-            pdb.interaction(t.tb_frame,t)
+            pdb.interaction(None, t)
             print "Post mortem debugger finished. The "+mainpyfile+" will be restarted"
 
 
index 4755db69bfb6e514c4e915e261306ec3d78bada8..0e726ea863a6b6b1a5b5c2bac30a22798e2eb175 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -24,6 +24,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #4150: Pdb's "up" command now works for generator frames in post-mortem
+  debugging.
+
 - Issue #4092: Return ArgInfo as promised in the documentation from
   inspect.getargvalues.