From: Nadav Har'El <[email protected]>
Committer: Nadav Har'El <[email protected]>
Branch: master

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]>

---
diff --git a/scripts/osv/trace.py b/scripts/osv/trace.py
--- a/scripts/osv/trace.py
+++ b/scripts/osv/trace.py
@@ -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 == '*':

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to