summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Arbet <michal.arbet@ultimum.io>2019-02-06 14:11:07 +0100
committerMichal Arbet <michal.arbet@ultimum.io>2019-02-06 15:22:26 +0100
commit5deb538930d98bf83e11bfb1dacb509982226540 (patch)
treefcdc0a8d1dc906e07273d37ddd235be63a4ac24f
parentb4120a1352c57c529e7a51737512a73acedec6a2 (diff)
Fix py37 compatibilityHEADmaster
Unit tests are failing under python3.7. Generators which explicitly raise StopIteration can generally be changed to simply return instead. This will be compatible with all existing Python versions. PEP Documentation for this change: https://www.python.org/dev/peps/pep-0479/ Change-Id: I4ae2049d8a2469d0a37077bdc722481e68d7cc49 Closes-Bug: #1814890
Notes
Notes (review): Code-Review+2: Spyros Trigazis <strigazi@gmail.com> Code-Review+1: Erik Olof Gunnar Andersson <eandersson@blizzard.com> Code-Review+2: Feilong Wang <flwang@catalyst.net.nz> Workflow+1: Feilong Wang <flwang@catalyst.net.nz> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Mon, 11 Feb 2019 19:59:16 +0000 Reviewed-on: https://review.openstack.org/635151 Project: openstack/python-magnumclient Branch: refs/heads/master
-rw-r--r--magnumclient/common/httpclient.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/magnumclient/common/httpclient.py b/magnumclient/common/httpclient.py
index ce9e4c9..038fb21 100644
--- a/magnumclient/common/httpclient.py
+++ b/magnumclient/common/httpclient.py
@@ -406,7 +406,10 @@ class ResponseBodyIterator(object):
406 406
407 def __iter__(self): 407 def __iter__(self):
408 while True: 408 while True:
409 yield self.next() 409 try:
410 yield self.next()
411 except StopIteration:
412 return
410 413
411 def __bool__(self): 414 def __bool__(self):
412 return hasattr(self, 'items') 415 return hasattr(self, 'items')
@@ -418,7 +421,7 @@ class ResponseBodyIterator(object):
418 if chunk: 421 if chunk:
419 return chunk 422 return chunk
420 else: 423 else:
421 raise StopIteration() 424 raise StopIteration
422 425
423 426
424def _construct_http_client(*args, **kwargs): 427def _construct_http_client(*args, **kwargs):