[pypy-commit] pypy py3.6: mmap.write() return the number of bytes written: AppLevel part

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


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3.6
Changeset: r93416:98fb1b0c5570
Date: 2017-12-13 23:52 +0100
http://bitbucket.org/pypy/pypy/changeset/98fb1b0c5570/

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

diff --git a/pypy/module/mmap/interp_mmap.py b/pypy/module/mmap/interp_mmap.py
--- a/pypy/module/mmap/interp_mmap.py
+++ b/pypy/module/mmap/interp_mmap.py
@@ -103,7 +103,7 @@
         data = self.space.charbuf_w(w_data)
         self.check_writeable()
         try:
-            self.mmap.write(data)
+            return self.space.newint(self.mmap.write(data))
         except RValueError as v:
             raise mmap_error(self.space, v)
 
diff --git a/pypy/module/mmap/test/test_mmap.py b/pypy/module/mmap/test/test_mmap.py
--- a/pypy/module/mmap/test/test_mmap.py
+++ b/pypy/module/mmap/test/test_mmap.py
@@ -268,7 +268,7 @@
         m = mmap.mmap(f.fileno(), 6, access=mmap.ACCESS_WRITE)
         raises(TypeError, m.write, 123)
         raises(ValueError, m.write, b"c"*10)
-        m.write(b"ciao\n")
+        assert m.write(b"ciao\n") == 5
         m.seek(0)
         assert m.read(6) == b"ciao\nr"
         m.close()


More information about the pypy-commit mailing list