Author: Armin Rigo <ar...@tunes.org>
Branch: py3k
Changeset: r87327:4b761da6ef73
Date: 2016-09-22 16:42 +0200
http://bitbucket.org/pypy/pypy/changeset/4b761da6ef73/

Log:    Test and fix

diff --git a/pypy/objspace/std/memoryobject.py 
b/pypy/objspace/std/memoryobject.py
--- a/pypy/objspace/std/memoryobject.py
+++ b/pypy/objspace/std/memoryobject.py
@@ -292,7 +292,7 @@
         itemsize = self.getitemsize()
         dim = 0
         self.buf = SubBuffer(self.buf, strides[dim] * (start//itemsize), 
size*step)
-        shape[dim] = size
+        shape[dim] = size//itemsize
         strides[dim] = strides[dim] * step
         self.strides = strides
         self.shape = shape
diff --git a/pypy/objspace/std/test/test_memoryobject.py 
b/pypy/objspace/std/test/test_memoryobject.py
--- a/pypy/objspace/std/test/test_memoryobject.py
+++ b/pypy/objspace/std/test/test_memoryobject.py
@@ -165,6 +165,11 @@
         slice = m[2:8]
         assert slice.format == 'i'
         assert slice.itemsize == 4
+        assert slice.ndim == 1
+        assert slice.readonly is False
+        assert slice.shape == (6,)
+        assert slice.strides == (4,)
+        assert slice.suboffsets == ()
         assert len(slice) == 6
         assert len(slice.tobytes()) == 24
         assert slice[0] == 2
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to