[pypy-svn] r15174 - pypy/dist/pypy/lib

tismer at codespeak.net tismer at codespeak.net
Wed Jul 27 13:10:58 CEST 2005


Author: tismer
Date: Wed Jul 27 13:10:55 2005
New Revision: 15174

Modified:
   pypy/dist/pypy/lib/osfilewrapper.py
Log:
small fix of osfilewrapper.
- windows behavior is different. check for the case that
  we read0 bytes (exit condition)
- logical error fixed as well.

Modified: pypy/dist/pypy/lib/osfilewrapper.py
==============================================================================
--- pypy/dist/pypy/lib/osfilewrapper.py	(original)
+++ pypy/dist/pypy/lib/osfilewrapper.py	Wed Jul 27 13:10:55 2005
@@ -13,7 +13,9 @@
         bufs = []
         while readcount < expected:
             # os.read will raise an error itself
-            buf = os.read(self.fd, expected)
+            buf = os.read(self.fd, expected - readcount)
+            if not buf:
+                break
             readcount += len(buf)
             bufs.append(buf)
         return "".join(bufs)



More information about the Pypy-commit mailing list