[pypy-commit] pypy default: Fix for the case of read(-1).

arigo noreply at buildbot.pypy.org
Mon Aug 1 18:08:39 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r46158:c5ebf30f4485
Date: 2011-08-01 16:51 +0200
http://bitbucket.org/pypy/pypy/changeset/c5ebf30f4485/

Log:	Fix for the case of read(-1).

diff --git a/pypy/module/_multibytecodec/app_multibytecodec.py b/pypy/module/_multibytecodec/app_multibytecodec.py
--- a/pypy/module/_multibytecodec/app_multibytecodec.py
+++ b/pypy/module/_multibytecodec/app_multibytecodec.py
@@ -13,13 +13,11 @@
         return self
 
     def __read(self, read, size):
+        if size is None or size < 0:
+            return MultibyteIncrementalDecoder.decode(self, read(), True)
         while True:
-            if size is None:
-                data = read()
-                final = True
-            else:
-                data = read(size)
-                final = not data
+            data = read(size)
+            final = not data
             output = MultibyteIncrementalDecoder.decode(self, data, final)
             if output or final:
                 return output


More information about the pypy-commit mailing list