diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-14 18:37:24 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-14 18:37:24 (GMT) |
commit | 328ec7455f11f14cb4bf7077c6a4fa48b2356433 (patch) | |
tree | 283338f8069ce73208fc79f2d66bf7a337a60e17 /Lib/_pyio.py | |
parent | 9e0b864ac07ab85b618ccf3831eae97b2c91fb2e (diff) | |
download | cpython-328ec7455f11f14cb4bf7077c6a4fa48b2356433.zip cpython-328ec7455f11f14cb4bf7077c6a4fa48b2356433.tar.gz cpython-328ec7455f11f14cb4bf7077c6a4fa48b2356433.tar.bz2 |
Issue #9854: The default read() implementation in io.RawIOBase now
handles non-blocking readinto() returning None correctly.
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index d6dce6d..83bce70 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -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") |