[pypy-svn] r46758 - in pypy/dist/pypy/rlib: . test

arigo at codespeak.net arigo at codespeak.net
Thu Sep 20 13:36:59 CEST 2007


Author: arigo
Date: Thu Sep 20 13:36:58 2007
New Revision: 46758

Modified:
   pypy/dist/pypy/rlib/rsocket_rffi.py
   pypy/dist/pypy/rlib/test/test_rsocket_rffi.py
Log:
Fix recv().


Modified: pypy/dist/pypy/rlib/rsocket_rffi.py
==============================================================================
--- pypy/dist/pypy/rlib/rsocket_rffi.py	(original)
+++ pypy/dist/pypy/rlib/rsocket_rffi.py	Thu Sep 20 13:36:58 2007
@@ -719,7 +719,8 @@
             try:
                 read_bytes = _c.socketrecv(self.fd, buf, buffersize, flags)
                 if read_bytes >= 0:
-                    return buf[:read_bytes]
+                    assert read_bytes <= buffersize
+                    return ''.join([buf[i] for i in range(read_bytes)])
             finally:
                 lltype.free(buf, flavor='raw')
         raise self.error_handler()

Modified: pypy/dist/pypy/rlib/test/test_rsocket_rffi.py
==============================================================================
--- pypy/dist/pypy/rlib/test/test_rsocket_rffi.py	(original)
+++ pypy/dist/pypy/rlib/test/test_rsocket_rffi.py	Thu Sep 20 13:36:58 2007
@@ -44,7 +44,6 @@
     assert a.get_host() == "127.0.0.1"
 
 def test_socketpair():
-    py.test.skip("in-progress")
     if sys.platform == "win32":
         py.test.skip('No socketpair on Windows')
     s1, s2 = socketpair()



More information about the Pypy-commit mailing list