Author: mattip <matti.pi...@gmail.com>
Branch: 
Changeset: r75843:5bd4d9346f9a
Date: 2015-02-12 23:01 +0200
http://bitbucket.org/pypy/pypy/changeset/5bd4d9346f9a/

Log:    test, fix creating an array from a 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
@@ -15,6 +15,7 @@
         self._base = base
         self.dtype = base.get_dtype()
         self.shape = [base.get_size()]
+        self.storage = self._base.implementation.storage
 
     def base(self):
         return self._base
diff --git a/pypy/module/micronumpy/test/test_ndarray.py 
b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -2852,6 +2852,13 @@
         c.flat = ['defgh', 'ijklmnop']
         assert (c.flatten() == ['def', 'ijk']*5).all()
 
+    def test_flatiter_subtype(self):
+        from numpy import array
+        x = array([[1, 2], [3, 4]]).T
+        y = array(x.flat)
+        assert (x == [[1, 3], [2, 4]]).all()
+
+
     def test_slice_copy(self):
         from numpy import zeros
         a = zeros((10, 10))
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to