mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #12175: BufferedReader.read(-1) now calls raw.readall() if available.
This commit is contained in:
parent
e9d44ccb22
commit
b57f108b03
5 changed files with 48 additions and 11 deletions
|
@ -944,6 +944,12 @@ class BufferedReader(_BufferedIOMixin):
|
|||
# Special case for when the number of bytes to read is unspecified.
|
||||
if n is None or n == -1:
|
||||
self._reset_read_buf()
|
||||
if hasattr(self.raw, 'readall'):
|
||||
chunk = self.raw.readall()
|
||||
if chunk is None:
|
||||
return buf[pos:] or None
|
||||
else:
|
||||
return buf[pos:] + chunk
|
||||
chunks = [buf[pos:]] # Strip the consumed bytes.
|
||||
current_size = 0
|
||||
while True:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue