Skip to content

Commit 8cd7d8a

Browse files
committed
trace.py: fix failure on newest Python
After https://www.python.org/dev/peps/pep-0479/ was done in Python 3.5 four years ago, it appears that recently Python 2.7.15 on Fedora 29 (at least that's what I tested) suddenly implemented this change as well. This change means that a generator cannot call just call next() on some iterator hoping that the end of iteration (via StopIteration exception) will automatically translate to an end of the generator. We now need to do this manually. Before this patch, "make check" fails on my Fedora 29, with the smoke_tracing_test part failing when it runs trace.py. Signed-off-by: Nadav Har'El <[email protected]>
1 parent 15c8ff7 commit 8cd7d8a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/osv/trace.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ def align_up(v, pagesize):
166166
def do_split_format(format_str):
167167
chars = iter(format_str)
168168
while True:
169-
c = next(chars)
169+
try:
170+
c = next(chars)
171+
except StopIteration:
172+
return
170173
if c in '<>=!@':
171174
raise Exception('Not supported: ' + c)
172175
if c == '*':

0 commit comments

Comments
 (0)