[pypy-commit] pypy matrixmath-reshape-merge: Fix copy for slices

mattip noreply at buildbot.pypy.org
Sat Dec 3 19:41:17 CET 2011


Author: mattip
Branch: matrixmath-reshape-merge
Changeset: r50093:7cf074391cf8
Date: 2011-12-03 18:39 +0200
http://bitbucket.org/pypy/pypy/changeset/7cf074391cf8/

Log:	Fix copy for slices

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
@@ -1282,9 +1282,11 @@
     def copy(self):
         array = NDimArray(self.size, self.shape[:], self.find_dtype())
         iter = self.start_iter()
+        a_iter = array.start_iter()
         while not iter.done():
-            array.setitem(iter.offset, self.getitem(iter.offset))
+            array.setitem(a_iter.offset, self.getitem(iter.offset))
             iter = iter.next(len(self.shape))
+            a_iter = a_iter.next(len(array.shape))
         return array
 
 class NDimArray(BaseArray):


More information about the pypy-commit mailing list