diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-01-18 19:06:19 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-01-18 19:06:19 (GMT) |
commit | 3013b16b62be7768700d685f6a68e606b5f20e5a (patch) | |
tree | 841a69e91c9102f4585e7bc11eb9c719ef689795 /Lib/test/test_memoryview.py | |
parent | 4a70550c1c3fb74985a2f4dd91a9a9cdb9e2fed6 (diff) | |
download | cpython-3013b16b62be7768700d685f6a68e606b5f20e5a.zip cpython-3013b16b62be7768700d685f6a68e606b5f20e5a.tar.gz cpython-3013b16b62be7768700d685f6a68e606b5f20e5a.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/test/test_memoryview.py')
-rw-r--r-- | Lib/test/test_memoryview.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py index 61e60fb..525ddea 100644 --- a/Lib/test/test_memoryview.py +++ b/Lib/test/test_memoryview.py @@ -9,6 +9,7 @@ import gc import weakref import array from test import test_support +import io class AbstractMemoryTests: @@ -230,6 +231,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. |