[pypy-commit] pypy default: merge heads

mattip noreply at buildbot.pypy.org
Mon Feb 11 19:53:34 CET 2013


Author: mattip <matti.picus at gmail.com>
Branch: 
Changeset: r61101:69281cba1f44
Date: 2013-02-11 20:45 +0200
http://bitbucket.org/pypy/pypy/changeset/69281cba1f44/

Log:	merge heads

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
@@ -904,15 +904,17 @@
         if order != 'C':  # or order != 'F':
             raise operationerrfmt(space.w_ValueError, "Unknown order: %s",
                                   order)
+
+    dtype = interp_dtype.decode_w_dtype(space, w_dtype)
     if isinstance(w_object, W_NDimArray):
         if (not space.is_none(w_dtype) and
-            w_object.get_dtype() is not w_dtype):
+            w_object.get_dtype() is not dtype):
             raise OperationError(space.w_NotImplementedError, space.wrap(
                                   "copying over different dtypes unsupported"))
         if copy:
             return w_object.descr_copy(space)
         return w_object
-    dtype = interp_dtype.decode_w_dtype(space, w_dtype)
+
     shape, elems_w = find_shape_and_elems(space, w_object, dtype)
     if dtype is None:
         for w_elem in elems_w:
diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -1736,6 +1736,13 @@
         assert a[1] == 0xff
         assert len(a.data) == 16
 
+
+    def test_explicit_dtype_conversion(self):
+        from _numpypy import array
+        a = array([1.0, 2.0])
+        b = array(a, dtype='d')
+        assert a.dtype is b.dtype
+
 class AppTestMultiDim(BaseNumpyAppTest):
     def test_init(self):
         import _numpypy


More information about the pypy-commit mailing list