[pypy-commit] pypy default: mmap.write() return the number of bytes written: RPython part

amauryfa pypy.commits at gmail.com
Wed Dec 13 17:55:40 EST 2017


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r93417:5ef9bb870cd2
Date: 2017-12-13 23:50 +0100
http://bitbucket.org/pypy/pypy/changeset/5ef9bb870cd2/

Log:	mmap.write() return the number of bytes written: RPython part

diff --git a/rpython/rlib/rmmap.py b/rpython/rlib/rmmap.py
--- a/rpython/rlib/rmmap.py
+++ b/rpython/rlib/rmmap.py
@@ -492,6 +492,7 @@
 
         self.setslice(start, data)
         self.pos = start + data_len
+        return data_len
 
     def write_byte(self, byte):
         if len(byte) != 1:
diff --git a/rpython/rlib/test/test_rmmap.py b/rpython/rlib/test/test_rmmap.py
--- a/rpython/rlib/test/test_rmmap.py
+++ b/rpython/rlib/test/test_rmmap.py
@@ -258,7 +258,7 @@
         f.flush()
         def func(no):
             m = mmap.mmap(no, 6, access=mmap.ACCESS_WRITE)
-            m.write("ciao\n")
+            assert m.write("ciao\n") == 5
             m.seek(0)
             assert m.read(6) == "ciao\nr"
             m.close()


More information about the pypy-commit mailing list