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):
|
def wrapper(*args, **kwargs):
|
||||||
parent = task(*args, **kwargs)
|
parent = task(*args, **kwargs)
|
||||||
|
|
||||||
subtask = next(parent)
|
try:
|
||||||
|
subtask = next(parent)
|
||||||
|
except StopIteration:
|
||||||
|
return
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
@ -317,7 +320,10 @@ def wrappertask(task):
|
||||||
except: # noqa
|
except: # noqa
|
||||||
subtask = parent.throw(*sys.exc_info())
|
subtask = parent.throw(*sys.exc_info())
|
||||||
else:
|
else:
|
||||||
subtask = next(parent)
|
try:
|
||||||
|
subtask = next(parent)
|
||||||
|
except StopIteration:
|
||||||
|
return
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue