[PATCH] D67812: [LNT] Python 3 support: Get next element with next builtin
    Thomas Preud'homme via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Sep 20 01:33:28 PDT 2019
    
    
  
thopre created this revision.
thopre added reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls.
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.
https://reviews.llvm.org/D67812
Files:
  lnt/testing/profile/profilev2impl.py
  lnt/tests/nt.py
Index: lnt/tests/nt.py
===================================================================
--- lnt/tests/nt.py
+++ lnt/tests/nt.py
@@ -772,7 +772,7 @@
     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')
 
Index: lnt/testing/profile/profilev2impl.py
===================================================================
--- lnt/testing/profile/profilev2impl.py
+++ lnt/testing/profile/profilev2impl.py
@@ -540,7 +540,7 @@
         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):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67812.220970.patch
Type: text/x-patch
Size: 1007 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190920/be724e15/attachment.bin>
    
    
More information about the llvm-commits
mailing list