aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-25 22:49:15 +0200
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-25 22:49:15 +0200
commit988512cfd7c896dd8b900d0f00cba05c4c807dc3 (patch)
tree00d1050f4d082f25471ca7b9e61aa745e29a99c8 /Lib/_pyio.py
parent(Merge 3.1) Issue #12175: FileIO.readall() now raises a ValueError instead of (diff)
parentIssue #12175: RawIOBase.readall() now returns None if read() returns None. (diff)
downloadcpython-988512cfd7c896dd8b900d0f00cba05c4c807dc3.tar.gz
cpython-988512cfd7c896dd8b900d0f00cba05c4c807dc3.tar.bz2
cpython-988512cfd7c896dd8b900d0f00cba05c4c807dc3.zip
(Merge 3.1) Issue #12175: RawIOBase.readall() now returns None if read()
returns None.
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r--Lib/_pyio.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index 35dea411e7c..b79d5fc6c19 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -558,7 +558,11 @@ class RawIOBase(IOBase):
if not data:
break
res += data
- return bytes(res)
+ if res:
+ return bytes(res)
+ else:
+ # b'' or None
+ return data
def readinto(self, b):
"""Read up to len(b) bytes into bytearray b.