mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
If size is specified, try to read at least size characters.
This is a alternative version of patch #1379332.
This commit is contained in:
parent
f8d767198f
commit
ca199432c2
2 changed files with 13 additions and 6 deletions
|
|
@ -274,7 +274,10 @@ def read(self, size=-1, chars=-1, firstline=False):
|
|||
while True:
|
||||
# can the request can be satisfied from the character buffer?
|
||||
if chars < 0:
|
||||
if self.charbuffer:
|
||||
if size < 0:
|
||||
if self.charbuffer:
|
||||
break
|
||||
elif len(self.charbuffer) >= size:
|
||||
break
|
||||
else:
|
||||
if len(self.charbuffer) >= chars:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue