[pypy-commit] pypy numpypy-array_prepare_-array_wrap: Call __array_prepare__ in more cases

rguillebert noreply at buildbot.pypy.org
Wed Jan 22 17:50:54 CET 2014


Author: Romain Guillebert <romain.py at gmail.com>
Branch: numpypy-array_prepare_-array_wrap
Changeset: r68845:07b429e67743
Date: 2014-01-22 17:19 +0100
http://bitbucket.org/pypy/pypy/changeset/07b429e67743/

Log:	Call __array_prepare__ in more cases

diff --git a/pypy/module/micronumpy/interp_ufuncs.py b/pypy/module/micronumpy/interp_ufuncs.py
--- a/pypy/module/micronumpy/interp_ufuncs.py
+++ b/pypy/module/micronumpy/interp_ufuncs.py
@@ -419,15 +419,17 @@
                 w_rhs.get_scalar_value().convert_to(space, calc_dtype)
             )
             if isinstance(out, W_NDimArray):
-                # TODO: Call __array_prepare__
+                # TODO: Array priority
+                out = loop.call_prepare(space, w_out, w_out)
+
                 if out.is_scalar():
                     out.set_scalar_value(arr)
                 else:
                     out.fill(space, arr)
             else:
-                # TODO: Call __array_prepare__
-                out = W_NDimArray(Scalar(res_dtype, res_dtype.box(0)))
-                out.set_scalar_value(arr)
+                # TODO: Array priority
+                out = loop.call_prepare(space, w_lhs, arr)
+                # XXX: How to set the value on the box since they're immutable ?
 
             return out
         new_shape = shape_agreement(space, w_lhs.get_shape(), w_rhs)


More information about the pypy-commit mailing list