[LNT] r372552 - [LNT] Python 3 support: Get next element with next builtin

Thomas Preud'homme via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 00:45:28 PDT 2019


Author: thopre
Date: Mon Sep 23 00:45:28 2019
New Revision: 372552

URL: http://llvm.org/viewvc/llvm-project?rev=372552&view=rev
Log:
[LNT] Python 3 support: Get next element with next builtin

Use next() builtin rather than the .next() method to retrieve the next
element of an iterator since the latter does not exist in Python 3.
next() builtin was introduced in Python 2.6. This was produced by
running futurize's stage1 libfuturize.fixes.fix_next_call.

Reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls

Reviewed By: hubert.reinterpretcast

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D67812

Modified:
    lnt/trunk/lnt/testing/profile/profilev2impl.py
    lnt/trunk/lnt/tests/nt.py

Modified: lnt/trunk/lnt/testing/profile/profilev2impl.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/testing/profile/profilev2impl.py?rev=372552&r1=372551&r2=372552&view=diff
==============================================================================
--- lnt/trunk/lnt/testing/profile/profilev2impl.py (original)
+++ lnt/trunk/lnt/testing/profile/profilev2impl.py Mon Sep 23 00:45:28 2019
@@ -541,7 +541,7 @@ class Functions(Section):
         address_gen = self.line_addresses.extractForFunction(fname)
         text_gen = self.line_text.extractForFunction(fname)
         for n in xrange(f['length']):
-            yield (counter_gen.next(), address_gen.next(), text_gen.next())
+            yield (next(counter_gen), next(address_gen), next(text_gen))
 
     def copy(self, counter_name_pool, line_counters,
              line_addresses, line_text):

Modified: lnt/trunk/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/nt.py?rev=372552&r1=372551&r2=372552&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/nt.py (original)
+++ lnt/trunk/lnt/tests/nt.py Mon Sep 23 00:45:28 2019
@@ -773,7 +773,7 @@ def load_nt_report_file(report_path, con
     reader_it = iter(csv.reader(report_file))
 
     # Get the header.
-    header = reader_it.next()
+    header = next(reader_it)
     if header[0] != 'Program':
         fatal('unexpected report file, missing header')
 




More information about the llvm-commits mailing list