[1.8.x] Refs #23763 -- Fixed Python 3.5 PendingDeprecationWarning in LazyStream.
Fixed "PendingDeprecationWarning: generator 'LazyStream.read.<locals>.parts'
raised StopIteration" per PEP 0479.
Backport of 3f2de80318
from master
This commit is contained in:
parent
e2ea30c440
commit
2a36a9bb15
|
@ -327,8 +327,11 @@ 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'
|
||||||
|
|
||||||
|
try:
|
||||||
chunk = next(self)
|
chunk = next(self)
|
||||||
|
except StopIteration:
|
||||||
|
return
|
||||||
|
else:
|
||||||
emitting = chunk[:remaining]
|
emitting = chunk[:remaining]
|
||||||
self.unget(chunk[remaining:])
|
self.unget(chunk[remaining:])
|
||||||
remaining -= len(emitting)
|
remaining -= len(emitting)
|
||||||
|
|
Loading…
Reference in New Issue