Skip to content
Snippets Groups Projects
Commit 5deb5389 authored by Michal Arbet's avatar Michal Arbet
Browse files

Fix py37 compatibility

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
parent b4120a13
Branches
Tags
No related merge requests found
...@@ -406,7 +406,10 @@ class ResponseBodyIterator(object): ...@@ -406,7 +406,10 @@ class ResponseBodyIterator(object):
def __iter__(self): def __iter__(self):
while True: while True:
yield self.next() try:
yield self.next()
except StopIteration:
return
def __bool__(self): def __bool__(self):
return hasattr(self, 'items') return hasattr(self, 'items')
...@@ -418,7 +421,7 @@ class ResponseBodyIterator(object): ...@@ -418,7 +421,7 @@ class ResponseBodyIterator(object):
if chunk: if chunk:
return chunk return chunk
else: else:
raise StopIteration() raise StopIteration
def _construct_http_client(*args, **kwargs): def _construct_http_client(*args, **kwargs):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment