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:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user