Skip to content

Commit

Permalink
trace.py: fix failure on newest Python
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
nyh committed Mar 17, 2019
1 parent 15c8ff7 commit 8cd7d8a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/osv/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ def align_up(v, pagesize):
def do_split_format(format_str):
chars = iter(format_str)
while True:
c = next(chars)
try:
c = next(chars)
except StopIteration:
return
if c in '<>=!@':
raise Exception('Not supported: ' + c)
if c == '*':
Expand Down

0 comments on commit 8cd7d8a

Please sign in to comment.