[pypy-commit] pypy default: do not chain ndarray.base; ensure ndarray.base.base is None

mattip noreply at buildbot.pypy.org
Sun Sep 27 11:57:32 CEST 2015


Author: mattip <matti.picus at gmail.com>
Branch: 
Changeset: r79862:399217ef3933
Date: 2015-09-27 02:38 +0300
http://bitbucket.org/pypy/pypy/changeset/399217ef3933/

Log:	do not chain ndarray.base; ensure ndarray.base.base is None

diff --git a/pypy/module/micronumpy/concrete.py b/pypy/module/micronumpy/concrete.py
--- a/pypy/module/micronumpy/concrete.py
+++ b/pypy/module/micronumpy/concrete.py
@@ -557,6 +557,11 @@
             self.size = ovfcheck(support.product_check(shape) * self.dtype.elsize)
         except OverflowError:
             raise oefmt(dtype.itemtype.space.w_ValueError, "array is too big.")
+        while orig_arr is not None:
+            assert isinstance(orig_arr, W_NDimArray)
+            if orig_arr.implementation.base() is None:
+                break
+            orig_arr = orig_arr.implementation.base()
         self.start = start
         self.orig_arr = orig_arr
         flags = parent.flags & NPY.ARRAY_ALIGNED


More information about the pypy-commit mailing list