Fix scheduler compatibility with Python 3.7
Always catch StopIteration, rather than allowing it to bubble up a level. This is neccessary due to PEP0479, wherein it was decided that Python will start converting this exception to a RuntimeError when it bubbles up, beginning with Python 3.7. Change-Id: I4e93b0e85500455de415188cc679961035958bd1
This commit is contained in:
parent
1c4fdf564e
commit
f7edd0ba2d
@ -282,7 +282,10 @@ def wrappertask(task):
|
||||
def wrapper(*args, **kwargs):
|
||||
parent = task(*args, **kwargs)
|
||||
|
||||
subtask = next(parent)
|
||||
try:
|
||||
subtask = next(parent)
|
||||
except StopIteration:
|
||||
return
|
||||
|
||||
while True:
|
||||
try:
|
||||
@ -317,7 +320,10 @@ def wrappertask(task):
|
||||
except: # noqa
|
||||
subtask = parent.throw(*sys.exc_info())
|
||||
else:
|
||||
subtask = next(parent)
|
||||
try:
|
||||
subtask = next(parent)
|
||||
except StopIteration:
|
||||
return
|
||||
|
||||
return wrapper
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user