mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #4569: Interpreter crash when mutating a memoryview with an item size larger than 1.
(together with a bit of reindenting)
This commit is contained in:
parent
f9734076cf
commit
bc420400eb
3 changed files with 117 additions and 93 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue