Merged revisions 84814 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84814 | antoine.pitrou | 2010-09-14 20:37:24 +0200 (mar., 14 sept. 2010) | 4 lines

  Issue #9854: The default read() implementation in io.RawIOBase now
  handles non-blocking readinto() returning None correctly.
........
This commit is contained in:
Antoine Pitrou 2010-09-14 18:53:07 +00:00
parent 0e428f2c3a
commit e5e75c64f2
5 changed files with 45 additions and 15 deletions

View file

@ -542,6 +542,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)
@ -559,7 +561,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")