mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
Issue #4580: slicing of memoryviews when itemsize != 1 is wrong.
Also fix len() to return number of items rather than length in bytes. I'm sorry it was not possible for me to work on this without reindenting a bit some stuff around. The indentation in memoryobject.c is a mess, I'll open a separate bug for it.
This commit is contained in:
parent
8bcddcabd7
commit
c3b39245a7
8 changed files with 297 additions and 216 deletions
|
@ -260,7 +260,7 @@ class IOTest(unittest.TestCase):
|
|||
|
||||
def test_array_writes(self):
|
||||
a = array.array('i', range(10))
|
||||
n = len(memoryview(a))
|
||||
n = len(a.tostring())
|
||||
f = io.open(support.TESTFN, "wb", 0)
|
||||
self.assertEqual(f.write(a), n)
|
||||
f.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue