[pypy-commit] pypy py3.5-memoryview: fixes, uncommented some test lines

plan_rich pypy.commits at gmail.com
Mon Aug 29 10:27:11 EDT 2016


Author: Richard Plangger <planrichi at gmail.com>
Branch: py3.5-memoryview
Changeset: r86702:e73551e958eb
Date: 2016-08-29 16:26 +0200
http://bitbucket.org/pypy/pypy/changeset/e73551e958eb/

Log:	fixes, uncommented some test lines

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
@@ -249,10 +249,12 @@
         if itemsize > 1:
             start *= itemsize
             size *= itemsize
-            stop  = start + size
-            # start & stop are now byte offset, thus use self.bug.getlength()
-            if stop > self.buf.getlength():
-                raise oefmt(space.w_IndexError, 'index out of range')
+
+        stop  = start + size
+        # start & stop are now byte offset, thus use self.buf.getlength()
+        if stop > self.buf.getlength():
+            raise oefmt(space.w_IndexError, 'index out of range')
+
         return start, stop, size
 
     def descr_setitem(self, space, w_index, w_obj):
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
@@ -355,7 +355,7 @@
         assert view.format == 'b'
         assert cview.format == 'i'
         #
-        assert cview.cast('i').cast('b').cast('i').tolist() == []
+        assert cview.cast('b').cast('q').cast('b').tolist() == []
         #
         assert cview.format == 'i'
         raises(TypeError, "cview.cast('i')")
@@ -366,7 +366,7 @@
                     strides=[8], shape=[6])
         view = memoryview(empty)
         byteview = view.cast('b')
-        #assert byteview.tolist() == [1,0,0,0,2,0,0,0,3,0,0,0]
+        assert byteview.tolist() == [1,0,0,0,2,0,0,0,3,0,0,0]
         i32view = byteview.cast('i', shape=[1,3])
         assert i32view.format == 'i'
         assert i32view.itemsize == 4


More information about the pypy-commit mailing list