Author: mattip <matti.pi...@gmail.com>
Branch: numpy-fixes
Changeset: r77219:e0b708050960
Date: 2015-05-08 17:45 +0300
http://bitbucket.org/pypy/pypy/changeset/e0b708050960/

Log:    fix for flatiter

diff --git a/pypy/module/micronumpy/flatiter.py 
b/pypy/module/micronumpy/flatiter.py
--- a/pypy/module/micronumpy/flatiter.py
+++ b/pypy/module/micronumpy/flatiter.py
@@ -97,6 +97,8 @@
         finally:
             self.iter.reset(self.state, mutate=True)
 
+    def descr___array_wrap__(self, space, obj):
+        return obj
 
 W_FlatIterator.typedef = TypeDef("numpy.flatiter",
     base = GetSetProperty(W_FlatIterator.descr_base),
@@ -116,4 +118,5 @@
     __le__ = interp2app(W_FlatIterator.descr_le),
     __gt__ = interp2app(W_FlatIterator.descr_gt),
     __ge__ = interp2app(W_FlatIterator.descr_ge),
+    __array_wrap__ = interp2app(W_NDimArray.descr___array_wrap__),
 )
diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py
--- a/pypy/module/micronumpy/loop.py
+++ b/pypy/module/micronumpy/loop.py
@@ -79,9 +79,9 @@
             space, res_dtype))
         out_state = out_iter.next(out_state)
     if out is None:
-        w_ret2 = space.call_method(w_rhs, '__array_wrap__', w_ret)
-        space.call_method(w_ret2, '__array_finalize__', lhs_for_subtype)
-    return w_ret2
+        w_ret = space.call_method(w_rhs, '__array_wrap__', w_ret)
+        space.call_method(w_ret, '__array_finalize__', lhs_for_subtype)
+    return w_ret
 
 call1_driver = jit.JitDriver(
     name='numpy_call1',
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to