[pypy-svn] r70546 - in pypy/branch/c-traceback/pypy/translator/c: src test

arigo at codespeak.net arigo at codespeak.net
Tue Jan 12 20:03:05 CET 2010


Author: arigo
Date: Tue Jan 12 20:03:03 2010
New Revision: 70546

Modified:
   pypy/branch/c-traceback/pypy/translator/c/src/debug_traceback.h
   pypy/branch/c-traceback/pypy/translator/c/test/test_standalone.py
Log:
Oups.  The traceback was in reverse order (when compared with
standard Python tracebacks).


Modified: pypy/branch/c-traceback/pypy/translator/c/src/debug_traceback.h
==============================================================================
--- pypy/branch/c-traceback/pypy/translator/c/src/debug_traceback.h	(original)
+++ pypy/branch/c-traceback/pypy/translator/c/src/debug_traceback.h	Tue Jan 12 20:03:03 2010
@@ -43,10 +43,10 @@
   const char *funcname;
 
   fprintf(stderr, "RPython traceback:\n");
-  for (i=PYPY_DEBUG_TRACEBACK_DEPTH-1; i>=0; i--)
+  for (i = 0; i < PYPY_DEBUG_TRACEBACK_DEPTH; i++)
     {
       if (i < pypy_debug_traceback_count)
-        break;
+        continue;
       filename = pypy_debug_tracebacks[i]->filename;
       funcname = pypy_debug_tracebacks[i]->funcname;
       lineno   = pypy_debug_tracebacks[i]->lineno;

Modified: pypy/branch/c-traceback/pypy/translator/c/test/test_standalone.py
==============================================================================
--- pypy/branch/c-traceback/pypy/translator/c/test/test_standalone.py	(original)
+++ pypy/branch/c-traceback/pypy/translator/c/test/test_standalone.py	Tue Jan 12 20:03:03 2010
@@ -396,8 +396,8 @@
         assert len(lines) >= 4
         l0, l1, l2 = lines[-4:-1]
         assert l0 == 'RPython traceback:'
-        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_g', l1)
-        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_entry_point', l2)
+        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_entry_point', l1)
+        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_g', l2)
         #
         out2, err2 = cbuilder.cmdexec("x", expect_crash=True)
         assert out2.strip() == ''
@@ -405,10 +405,10 @@
         assert lines2[-1] == 'Fatal RPython error: KeyError'
         l0, l1, l2 = lines2[-4:-1]
         assert l0 == 'RPython traceback:'
-        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_g', l1)
-        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_entry_point', l2)
-        assert lines2[-3] != lines[-3]    # different line number
-        assert lines2[-2] == lines[-2]    # same line number
+        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_entry_point', l1)
+        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_g', l2)
+        assert lines2[-2] != lines[-2]    # different line number
+        assert lines2[-3] == lines[-3]    # same line number
 
     def test_assertion_error(self):
         def g(x):
@@ -429,8 +429,8 @@
         assert len(lines) >= 4
         l0, l1, l2 = lines[-4:-1]
         assert l0 == 'RPython traceback:'
-        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_g', l1)
-        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_f', l2)
+        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_f', l1)
+        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_g', l2)
         # The traceback stops at f() because it's the first function that
         # captures the AssertionError, which makes the program abort.
 
@@ -454,8 +454,8 @@
         assert len(lines) >= 4
         l0, l1, l2 = lines[-4:-1]
         assert l0 == 'RPython traceback:'
-        assert re.match(r'  File "\w+.c", line \d+, in g', l1)
-        assert re.match(r'  File "\w+.c", line \d+, in f', l2)
+        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_f', l1)
+        assert re.match(r'  File "\w+.c", line \d+, in pypy_g_g', l2)
         # The traceback stops at f() because it's the first function that
         # captures the AssertionError, which makes the program abort.
 



More information about the Pypy-commit mailing list