summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-01-18 19:06:09 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-01-18 19:06:09 (GMT)
commit566facd39b90595b1b7ab61a26c77e426ac22c73 (patch)
tree002b459ea188474c49d112b18f98469ca15bfffc /Lib
parentcbb98950db66e17ffb3219d1d19a001a6b4020cc (diff)
downloadcpython-566facd39b90595b1b7ab61a26c77e426ac22c73.zip
cpython-566facd39b90595b1b7ab61a26c77e426ac22c73.tar.gz
cpython-566facd39b90595b1b7ab61a26c77e426ac22c73.tar.bz2
Merged revisions 88097 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r88097 | antoine.pitrou | 2011-01-18 19:57:52 +0100 (mar., 18 janv. 2011) | 4 lines Issue #10451: memoryview objects could allow to mutate a readable buffer. Initial patch by Ross Lagerwall. ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_memoryview.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py
index fd820b6..52fa3a9 100644
--- a/Lib/test/test_memoryview.py
+++ b/Lib/test/test_memoryview.py
@@ -9,6 +9,7 @@ import sys
import gc
import weakref
import array
+import io
class AbstractMemoryTests:
@@ -225,6 +226,16 @@ class AbstractMemoryTests:
gc.collect()
self.assertTrue(wr() is None, wr())
+ def test_writable_readonly(self):
+ # Issue #10451: memoryview incorrectly exposes a readonly
+ # buffer as writable causing a segfault if using mmap
+ tp = self.ro_type
+ if tp is None:
+ return
+ b = tp(self._source)
+ m = self._view(b)
+ i = io.BytesIO(b'ZZZZ')
+ self.assertRaises(TypeError, i.readinto, m)
# Variations on source objects for the buffer: bytes-like objects, then arrays
# with itemsize > 1.