[py-svn] r59268 - py/trunk/py/test

arigo at codespeak.net arigo at codespeak.net
Mon Oct 20 15:45:11 CEST 2008


Author: arigo
Date: Mon Oct 20 15:45:10 2008
New Revision: 59268

Modified:
   py/trunk/py/test/custompdb.py
Log:
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.



Modified: py/trunk/py/test/custompdb.py
==============================================================================
--- py/trunk/py/test/custompdb.py	(original)
+++ py/trunk/py/test/custompdb.py	Mon Oct 20 15:45:10 2008
@@ -56,13 +56,19 @@
                 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



More information about the pytest-commit mailing list