[pypy-commit] pypy default: Backed out changeset: d198d926afb8, more tests needed

mattip noreply at buildbot.pypy.org
Fri Apr 24 11:20:37 CEST 2015


Author: mattip <matti.picus at gmail.com>
Branch: 
Changeset: r76917:8cb5c941efb4
Date: 2015-04-24 12:18 +0300
http://bitbucket.org/pypy/pypy/changeset/8cb5c941efb4/

Log:	Backed out changeset: d198d926afb8, more tests needed

diff --git a/pypy/module/micronumpy/concrete.py b/pypy/module/micronumpy/concrete.py
--- a/pypy/module/micronumpy/concrete.py
+++ b/pypy/module/micronumpy/concrete.py
@@ -328,11 +328,8 @@
         return ArrayBuffer(self, readonly)
 
     def astype(self, space, dtype):
-        # we want to create a new array, but must respect the strides
-        # in self. So find a factor of the itemtype.elsize, and use this
-        factor = float(dtype.elsize) / self.dtype.elsize
-        strides = [int(factor*s) for s in self.get_strides()]
-        backstrides = [int(factor*s) for s in self.get_backstrides()]
+        strides, backstrides = calc_strides(self.get_shape(), dtype,
+                                                    self.order)
         impl = ConcreteArray(self.get_shape(), dtype, self.order,
                              strides, backstrides)
         loop.setslice(space, impl.get_shape(), impl, self)
diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -2183,8 +2183,7 @@
         assert b.dtype == 'bool'
 
         a = arange(6, dtype='f4').reshape(2,3)
-        b = a.T.astype('i4')
-        assert (a.T.strides == b.strides)
+        b = a.astype('i4')
 
         a = array('x').astype('S3').dtype
         assert a.itemsize == 3


More information about the pypy-commit mailing list