From b7442c569496e0d8d2100f9cd62160f2d7b3bcee Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Fri, 29 Jun 2018 14:30:53 +0100 Subject: [PATCH] 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: Ia067940066a5666926dcf61136b03d721a87666e --- glanceclient/v2/images.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py index 89aa9127..fbb67a96 100644 --- a/glanceclient/v2/images.py +++ b/glanceclient/v2/images.py @@ -125,7 +125,7 @@ class Controller(object): if limit: limit -= 1 if limit <= 0: - raise StopIteration + return try: next_url = body['next']