Replace 'raise StopIteration' with 'return'
With PEP 479, the behaviour of StopIteration is changing. Raising it to stop a generator is considered incorrect and from Python 3.7 this will cause a RuntimeError. The PEP recommends using the return statement. More details: https://www.python.org/dev/peps/pep-0479/#examples-of-breakage Change-Id: If53f0f4c313a699a4036838ab6035fffa931931b
This commit is contained in:
parent
9e2d282b4d
commit
2fb1dcbe5e
|
@ -243,7 +243,7 @@ class Backups(base.ManagerWithFind):
|
|||
yield the_item
|
||||
m = the_list[-1].id
|
||||
else:
|
||||
raise StopIteration()
|
||||
return
|
||||
|
||||
def execution_list_generator():
|
||||
yielded = 0
|
||||
|
@ -254,7 +254,7 @@ class Backups(base.ManagerWithFind):
|
|||
loaded=True)
|
||||
yielded += 1
|
||||
if limit and yielded == limit:
|
||||
raise StopIteration()
|
||||
return
|
||||
|
||||
return list(execution_list_generator())
|
||||
|
||||
|
|
Loading…
Reference in New Issue