Skip to content

Commit a7aaae6

Browse files
author
Thomas Preud'homme
committed
[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 llvm-svn: 372552
1 parent 4ff5110 commit a7aaae6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lnt/testing/profile/profilev2impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ def getCodeForFunction(self, fname):
541541
address_gen = self.line_addresses.extractForFunction(fname)
542542
text_gen = self.line_text.extractForFunction(fname)
543543
for n in xrange(f['length']):
544-
yield (counter_gen.next(), address_gen.next(), text_gen.next())
544+
yield (next(counter_gen), next(address_gen), next(text_gen))
545545

546546
def copy(self, counter_name_pool, line_counters,
547547
line_addresses, line_text):

lnt/tests/nt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ def append_to_sample_keys(tup):
773773
reader_it = iter(csv.reader(report_file))
774774

775775
# Get the header.
776-
header = reader_it.next()
776+
header = next(reader_it)
777777
if header[0] != 'Program':
778778
fatal('unexpected report file, missing header')
779779

0 commit comments

Comments
 (0)