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.
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 0fc017f..af5b6f4 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -260,7 +260,7 @@
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()