mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Issue #9854: The default read() implementation in io.RawIOBase now
handles non-blocking readinto() returning None correctly.
This commit is contained in:
parent
9e0b864ac0
commit
328ec7455f
5 changed files with 45 additions and 15 deletions
|
@ -544,6 +544,8 @@ class RawIOBase(IOBase):
|
|||
return self.readall()
|
||||
b = bytearray(n.__index__())
|
||||
n = self.readinto(b)
|
||||
if n is None:
|
||||
return None
|
||||
del b[n:]
|
||||
return bytes(b)
|
||||
|
||||
|
@ -561,7 +563,7 @@ class RawIOBase(IOBase):
|
|||
"""Read up to len(b) bytes into b.
|
||||
|
||||
Returns number of bytes read (0 for EOF), or None if the object
|
||||
is set not to block as has no data to read.
|
||||
is set not to block and has no data to read.
|
||||
"""
|
||||
self._unsupported("readinto")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue