Handle StopIteration for Py3.7
Catch the raise of StopIteration with return. PEP 0479, https://www.python.org/dev/peps/pep-0479/, makes the following change: "when StopIteration is raised inside a generator, it is replaced it with RuntimeError". And states: "If raise StopIteration occurs directly in a generator, simply replace it with return." Closes-Bug: #1785309 Change-Id: Ib751b680b7357782cb5359526e1e83ee8c5c80dd
This commit is contained in:
parent
a7e4f32009
commit
668e899188
@ -395,7 +395,10 @@ class ResponseBodyIterator(object):
|
||||
|
||||
def __iter__(self):
|
||||
while True:
|
||||
yield self.next()
|
||||
try:
|
||||
yield self.next()
|
||||
except StopIteration:
|
||||
return
|
||||
|
||||
def next(self):
|
||||
chunk = self.resp.read(CHUNKSIZE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user