[pypy-commit] pypy refactor-signature: fix the test

fijal noreply at buildbot.pypy.org
Mon Dec 19 22:32:04 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: refactor-signature
Changeset: r50723:82c25e00eebe
Date: 2011-12-19 23:31 +0200
http://bitbucket.org/pypy/pypy/changeset/82c25e00eebe/

Log:	fix the test

diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -612,9 +612,9 @@
         shape += self.shape[s:]
         if not isinstance(self, ConcreteArray):
             return VirtualSlice(self, chunks, shape)
-        r = calculate_slice_strides(self.start, self.strides, self.backstrides,
-                                    chunks)
-        start, strides, backstrides = r
+        r = calculate_slice_strides(self.shape, self.start, self.strides,
+                                    self.backstrides, chunks)
+        _, start, strides, backstrides = r
         return W_NDimSlice(start, strides[:], backstrides[:],
                            shape[:], self)
 
diff --git a/pypy/module/micronumpy/signature.py b/pypy/module/micronumpy/signature.py
--- a/pypy/module/micronumpy/signature.py
+++ b/pypy/module/micronumpy/signature.py
@@ -114,14 +114,14 @@
         return compute_identity_hash(self.dtype)
 
     def allocate_view_iter(self, arr, res_shape, chunklist):
-        r = arr.start, arr.strides, arr.backstrides
+        r = arr.shape, arr.start, arr.strides, arr.backstrides
         if chunklist:
             for chunkelem in chunklist:
-                r = calculate_slice_strides(r[0], r[1], r[2], chunkelem)
-        start, strides, backstrides = r
+                r = calculate_slice_strides(r[0], r[1], r[2], r[3], chunkelem)
+        shape, start, strides, backstrides = r
         if len(res_shape) == 1:
             return OneDimIterator(start, strides[0], res_shape[0])
-        return ViewIterator(start, strides, backstrides, arr.shape, res_shape)
+        return ViewIterator(start, strides, backstrides, shape, res_shape)
 
 class ArraySignature(ConcreteSignature):
     def debug_repr(self):
diff --git a/pypy/module/micronumpy/strides.py b/pypy/module/micronumpy/strides.py
--- a/pypy/module/micronumpy/strides.py
+++ b/pypy/module/micronumpy/strides.py
@@ -1,20 +1,23 @@
 
-def calculate_slice_strides(start, strides, backstrides, chunks):
+def calculate_slice_strides(shape, start, strides, backstrides, chunks):
     rstrides = []
     rbackstrides = []
     rstart = start
+    rshape = []
     i = -1
     for i, (start_, stop, step, lgt) in enumerate(chunks):
         if step != 0:
             rstrides.append(strides[i] * step)
             rbackstrides.append(strides[i] * (lgt - 1) * step)
+            rshape.append(lgt)
         rstart += strides[i] * start_
     # add a reminder
     s = i + 1
     assert s >= 0
     rstrides += strides[s:]
     rbackstrides += backstrides[s:]
-    return rstart, rstrides, rbackstrides
+    rshape += shape[s:]
+    return rshape, rstart, rstrides, rbackstrides
 
 def calculate_broadcast_strides(strides, backstrides, orig_shape, res_shape):
     rstrides = []


More information about the pypy-commit mailing list