[PATCH] D67819: [LNT] Python 3 support: adapt to zip returning a view

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 20 01:42:29 PDT 2019


thopre created this revision.
thopre added reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls.
thopre added a parent revision: D67818: [LNT] Python 3 support: adapt to renaming of raw_input to input.
thopre added a child revision: D67820: [LNT] Python 3 support: get rid of calls to cmp builtin.

Adapt calls to zip() to the fact it returns a view in Python3. This was
produced by running futurize's stage2 lib2to3.fixes.fix_zip.


https://reviews.llvm.org/D67819

Files:
  lnt/server/reporting/analysis.py
  lnt/server/reporting/report.py
  lnt/tests/nt.py


Index: lnt/tests/nt.py
===================================================================
--- lnt/tests/nt.py
+++ lnt/tests/nt.py
@@ -790,7 +790,7 @@
     test_samples = []
     no_errors = True
     for row in reader_it:
-        record = dict(zip(header, row))
+        record = dict(list(zip(header, row)))
 
         program = record['Program']
 
Index: lnt/server/reporting/report.py
===================================================================
--- lnt/server/reporting/report.py
+++ lnt/server/reporting/report.py
@@ -8,8 +8,8 @@
 
 OrderAndHistory = namedtuple('OrderAndHistory', ['max_order', 'recent_orders'])
 
-def pairs(list):
-    return zip(list[:-1], list[1:])
+def pairs(l):
+    return list(zip(l[:-1], l[1:]))
 
 # The hash color palette avoids green and red as these colours are already used
 # in quite a few places to indicate "good" or "bad".
Index: lnt/server/reporting/analysis.py
===================================================================
--- lnt/server/reporting/analysis.py
+++ lnt/server/reporting/analysis.py
@@ -372,8 +372,8 @@
                            for _, _, cr in tests
                            if cr.get_test_status() == UNCHANGED_PASS]
         if unchanged_tests:
-            prev_values, run_values, prev_hash, cur_hash = zip(
-                *unchanged_tests)
+            prev_values, run_values, prev_hash, cur_hash = list(zip(
+                *unchanged_tests))
             prev_values = [x for x in prev_values if x is not None]
             run_values = [x for x in run_values if x is not None]
             prev_hash = [x for x in prev_hash if x is not None]


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67819.220977.patch
Type: text/x-patch
Size: 1632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190920/6a742450/attachment.bin>


More information about the llvm-commits mailing list