[pypy-commit] pypy default: fix base after __array__

bdkearns noreply at buildbot.pypy.org
Fri Dec 13 06:29:57 CET 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r68416:e028990fb8df
Date: 2013-12-13 00:29 -0500
http://bitbucket.org/pypy/pypy/changeset/e028990fb8df/

Log:	fix base after __array__

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
@@ -496,7 +496,8 @@
         if type(self) is W_NDimArray:
             return self
         return W_NDimArray.from_shape_and_storage(
-            space, self.get_shape(), self.implementation.storage, self.get_dtype())
+            space, self.get_shape(), self.implementation.storage,
+            self.get_dtype(), w_base=self)
 
     def descr_array_iface(self, space):
         addr = self.implementation.get_storage_as_int(space)
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
@@ -52,9 +52,11 @@
 
         assert type(a) is not ndarray
         assert a[0,0] == 100
+        assert a.base is not None
         b = a.__array__()
         assert type(b) is ndarray
         assert b[0,0] == 100
+        assert b.base is a
 
     def test_subtype_view(self):
         from numpypy import ndarray, array


More information about the pypy-commit mailing list