[pypy-commit] pypy fortran-order: test, fix 'A' for empty_like, zeros_like order

mattip noreply at buildbot.pypy.org
Fri Oct 9 13:51:30 CEST 2015


Author: mattip <matti.picus at gmail.com>
Branch: fortran-order
Changeset: r80077:cf73e9b4ad42
Date: 2015-10-07 00:18 +0300
http://bitbucket.org/pypy/pypy/changeset/cf73e9b4ad42/

Log:	test, fix 'A' for empty_like, zeros_like order

diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py
--- a/pypy/module/micronumpy/ctors.py
+++ b/pypy/module/micronumpy/ctors.py
@@ -297,9 +297,9 @@
             space.call_function(space.gettypefor(descriptor.W_Dtype), w_dtype))
         if dtype.is_str_or_unicode() and dtype.elsize < 1:
             dtype = descriptor.variable_dtype(space, dtype.char + '1')
-    if npy_order == NPY.KEEPORDER:
+    if npy_order in (NPY.KEEPORDER, NPY.ANYORDER):
         # Try to copy the stride pattern
-        impl = w_a.implementation.astype(space, dtype, npy_order)
+        impl = w_a.implementation.astype(space, dtype, NPY.KEEPORDER)
         if subok:
             w_type = space.type(w_a)
         else:
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
@@ -445,6 +445,8 @@
         b = np.empty_like(A((2, 3)), subok=False)
         assert b.shape == (2, 3)
         assert type(b) is np.ndarray
+        b = np.empty_like(np.array(3.0), order='A')
+        assert type(b) is np.ndarray
 
     def test_size(self):
         from numpy import array,arange,cos


More information about the pypy-commit mailing list