Author: Matti Picus <[email protected]>
Branch: ndarray-subtype
Changeset: r65386:d88d7304799b
Date: 2013-07-14 00:34 +0300
http://bitbucket.org/pypy/pypy/changeset/d88d7304799b/

Log:    fix test and implementation for where()

diff --git a/pypy/module/micronumpy/interp_arrayops.py 
b/pypy/module/micronumpy/interp_arrayops.py
--- a/pypy/module/micronumpy/interp_arrayops.py
+++ b/pypy/module/micronumpy/interp_arrayops.py
@@ -88,7 +88,7 @@
                                                   y.get_dtype())
     shape = shape_agreement(space, arr.get_shape(), x)
     shape = shape_agreement(space, shape, y)
-    out = W_NDimArray.from_shape(space, shape, dtype, w_subtype=arr)
+    out = W_NDimArray.from_shape(space, shape, dtype)
     return loop.where(out, shape, arr, x, y, dtype)
 
 def dot(space, w_obj1, w_obj2):
diff --git a/pypy/module/micronumpy/test/test_subtype.py 
b/pypy/module/micronumpy/test/test_subtype.py
--- a/pypy/module/micronumpy/test/test_subtype.py
+++ b/pypy/module/micronumpy/test/test_subtype.py
@@ -100,7 +100,10 @@
         from numpypy import where, ones, zeros, array
         a = array([1, 2, 3, 0, -3])
         v = a.view(self.NoNew)
-        assert False
+        b = where(array(v) > 0, ones(5), zeros(5))
+        assert (b == [1, 1, 1, 0, 0]).all()
+        # where returns an ndarray irregardless of the subtype of v
+        assert not isinstance(b, self.NoNew)
 
     def test_sub_repeat(self):
         assert False
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to