summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDougal Matthews <dougal@redhat.com>2018-06-29 14:27:21 +0100
committerDougal Matthews <dougal@redhat.com>2018-06-29 14:28:27 +0100
commit2fb1dcbe5e8c8a826e8a9567ffb49295a2402641 (patch)
treefb9bda7e41db8020a1e30f392c95f020b7d9de32
parent9e2d282b4de0ef5e7e7dbecce70af34c2d60d5dd (diff)
downloadpython-troveclient-2fb1dcbe5e8c8a826e8a9567ffb49295a2402641.tar.gz
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
-rw-r--r--troveclient/v1/backups.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/troveclient/v1/backups.py b/troveclient/v1/backups.py
index 0ba18e7..f314fdc 100644
--- a/troveclient/v1/backups.py
+++ b/troveclient/v1/backups.py
@@ -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())