Refs #23763 -- Fixed Python 3.5 PendingDeprecationWarning in LazyStream.
Fixed "PendingDeprecationWarning: generator 'LazyStream.read.<locals>.parts' raised StopIteration" per PEP 0479.
This commit is contained in:
parent
cf6ce279c7
commit
3f2de80318
|
@ -327,12 +327,15 @@ class LazyStream(six.Iterator):
|
||||||
while remaining != 0:
|
while remaining != 0:
|
||||||
assert remaining > 0, 'remaining bytes to read should never go negative'
|
assert remaining > 0, 'remaining bytes to read should never go negative'
|
||||||
|
|
||||||
chunk = next(self)
|
try:
|
||||||
|
chunk = next(self)
|
||||||
emitting = chunk[:remaining]
|
except StopIteration:
|
||||||
self.unget(chunk[remaining:])
|
return
|
||||||
remaining -= len(emitting)
|
else:
|
||||||
yield emitting
|
emitting = chunk[:remaining]
|
||||||
|
self.unget(chunk[remaining:])
|
||||||
|
remaining -= len(emitting)
|
||||||
|
yield emitting
|
||||||
|
|
||||||
out = b''.join(parts())
|
out = b''.join(parts())
|
||||||
return out
|
return out
|
||||||
|
|
Loading…
Reference in New Issue