Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r71293:59dc90f4fe8a
Date: 2014-05-05 17:33 -0700
http://bitbucket.org/pypy/pypy/changeset/59dc90f4fe8a/

Log:    fix memoryview.readonly degrading to int from bool

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
@@ -19,7 +19,8 @@
 
     def buffer_w(self, space, flags):
         self.check_valid()
-        return MMapBuffer(self.space, self.mmap, flags & space.BUF_WRITABLE)
+        return MMapBuffer(self.space, self.mmap,
+                          bool(flags & space.BUF_WRITABLE))
 
     def close(self):
         self.mmap.close()
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
@@ -536,6 +536,7 @@
         m = mmap(f.fileno(), 6)
         b = memoryview(m)
         assert len(b) == 6
+        assert b.readonly is False
         assert b[3] == b"b"
         assert b[:] == b"foobar"
         del b  # For CPython: "exported pointers exist"
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to