Author: Squeaky <[email protected]>
Branch: array-propagate-len
Changeset: r69151:6bace6054472
Date: 2014-02-14 12:15 +0100
http://bitbucket.org/pypy/pypy/changeset/6bace6054472/

Log:    Fix optimized trace debugging utility. Previously the print loop
        would use zip which always truncates the output to the shorter list.
        This produces confusing output becuase it would later fail on trace
        length mismatch but printing truncated output to stdout looks like
        there is same number of operations.

diff --git a/rpython/jit/metainterp/optimizeopt/util.py 
b/rpython/jit/metainterp/optimizeopt/util.py
--- a/rpython/jit/metainterp/optimizeopt/util.py
+++ b/rpython/jit/metainterp/optimizeopt/util.py
@@ -1,3 +1,5 @@
+import itertools
+
 import py
 from rpython.rlib.objectmodel import r_dict, compute_identity_hash
 from rpython.rlib.rarithmetic import intmask
@@ -136,13 +138,16 @@
     print ' Comparing lists '.center(totwidth, '-')
     text_right = text_right or 'expected'
     print '%s| %s' % ('optimized'.center(width), text_right.center(width))
-    for op1, op2 in zip(oplist1, oplist2):
+    for op1, op2 in itertools.izip_longest(oplist1, oplist2, fillvalue=''):
         txt1 = str(op1)
         txt2 = str(op2)
         while txt1 or txt2:
             print '%s| %s' % (txt1[:width].ljust(width), txt2[:width])
             txt1 = txt1[width:]
             txt2 = txt2[width:]
+    print '-' * totwidth
+
+    for op1, op2 in zip(oplist1, oplist2):
         assert op1.getopnum() == op2.getopnum()
         assert op1.numargs() == op2.numargs()
         for i in range(op1.numargs()):
@@ -177,6 +182,5 @@
                     else:
                         assert False
     assert len(oplist1) == len(oplist2)
-    print '-'*totwidth
     return True
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to