summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2008-12-07 20:14:49 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2008-12-07 20:14:49 (GMT)
commitbc420400eb8d51ed16aa0c759363cb4248d3c946 (patch)
treef8ef5db33b2b242d4d6645bf1553c348c949f933 /Lib/test
parentf9734076cf12444fb1b5e4296993bf6df3b1e7f2 (diff)
downloadcpython-bc420400eb8d51ed16aa0c759363cb4248d3c946.zip
cpython-bc420400eb8d51ed16aa0c759363cb4248d3c946.tar.gz
cpython-bc420400eb8d51ed16aa0c759363cb4248d3c946.tar.bz2
Issue #4569: Interpreter crash when mutating a memoryview with an item size larger than 1.
(together with a bit of reindenting)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_memoryview.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py
index 93a3fcb..7139065 100644
--- a/Lib/test/test_memoryview.py
+++ b/Lib/test/test_memoryview.py
@@ -207,6 +207,15 @@ class MemoryviewTest(unittest.TestCase, CommonMemoryTests):
self.assertRaises(TypeError, memoryview, argument=ob)
self.assertRaises(TypeError, memoryview, ob, argument=True)
+ def test_array_assign(self):
+ # Issue #4569: segfault when mutating a memoryview with itemsize != 1
+ from array import array
+ a = array('i', range(10))
+ m = memoryview(a)
+ new_a = array('i', range(9, -1, -1))
+ m[:] = new_a
+ self.assertEquals(a, new_a)
+
class MemorySliceTest(unittest.TestCase, CommonMemoryTests):
base_object = b"XabcdefY"