summaryrefslogtreecommitdiff
path: root/Lib/codecs.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2006-03-06 22:39:12 +0000
committerWalter Dörwald <walter@livinglogic.de>2006-03-06 22:39:12 +0000
commitca199432c23fa00ab3702e64a136c377950e5068 (patch)
treed46c22940fbd7bca5c5913cdda3f501ce26ffb37 /Lib/codecs.py
parentf8d767198f11ab1011164d907de8332138162d94 (diff)
downloadcpython-git-ca199432c23fa00ab3702e64a136c377950e5068.tar.gz
If size is specified, try to read at least size characters.
This is a alternative version of patch #1379332.
Diffstat (limited to 'Lib/codecs.py')
-rw-r--r--Lib/codecs.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/codecs.py b/Lib/codecs.py
index 932f01bec7..6895a228fe 100644
--- a/Lib/codecs.py
+++ b/Lib/codecs.py
@@ -274,7 +274,10 @@ class StreamReader(Codec):
while True:
# can the request can be satisfied from the character buffer?
if chars < 0:
- if self.charbuffer:
+ if size < 0:
+ if self.charbuffer:
+ break
+ elif len(self.charbuffer) >= size:
break
else:
if len(self.charbuffer) >= chars: