From 90ae14efcdde02de9bfe3f70fabdabc535674ae1 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 4 Oct 2018 08:44:48 +0200 Subject: [PATCH] dsdl_compiler: check for StopIteration exception This fixes the exception happening with Python 3.7. I'm assuming this has to do with: https://www.python.org/dev/peps/pep-0479/ --- libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py index 913f88c0e2..eaddd0a9b0 100644 --- a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py +++ b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py @@ -298,7 +298,10 @@ def make_template_expander(filename): def enum_last_value(iterable, start=0): it = iter(iterable) count = start - last = next(it) + try: + last = next(it) + except StopIteration: + return for val in it: yield count, False, last last = val