summaryrefslogtreecommitdiffstats
path: root/Lib/codecs.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/codecs.py')
-rw-r--r--Lib/codecs.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/codecs.py b/Lib/codecs.py
index 44618cb..a70ed20 100644
--- a/Lib/codecs.py
+++ b/Lib/codecs.py
@@ -480,15 +480,17 @@ class StreamReader(Codec):
self.charbuffer = self._empty_charbuffer.join(self.linebuffer)
self.linebuffer = None
+ if chars < 0:
+ # For compatibility with other read() methods that take a
+ # single argument
+ chars = size
+
# read until we get the required number of characters (if available)
while True:
# can the request be satisfied from the character buffer?
if chars >= 0:
if len(self.charbuffer) >= chars:
break
- elif size >= 0:
- if len(self.charbuffer) >= size:
- break
# we need more data
if size < 0:
newdata = self.stream.read()