[pypy-commit] pypy numpypy-segfault: test, fix creating empty axis iterator
mattip
noreply at buildbot.pypy.org
Mon Jul 1 23:01:15 CEST 2013
Author: Matti Picus <matti.picus at gmail.com>
Branch: numpypy-segfault
Changeset: r65155:df376dab84d2
Date: 2013-07-02 00:00 +0300
http://bitbucket.org/pypy/pypy/changeset/df376dab84d2/
Log: test, fix creating empty axis iterator
diff --git a/pypy/module/micronumpy/iter.py b/pypy/module/micronumpy/iter.py
--- a/pypy/module/micronumpy/iter.py
+++ b/pypy/module/micronumpy/iter.py
@@ -285,7 +285,7 @@
self.backstrides = backstrides[:dim] + [0] + backstrides[dim:]
self.first_line = True
self.indices = [0] * len(shape)
- self._done = False
+ self._done = array.get_size() == 0
self.offset = array.start
self.dim = dim
self.array = array
diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -298,11 +298,8 @@
# b = tile(a, (3, 2, 5))
reps = (3, 4, 5)
c = array(a, copy=False, subok=True, ndmin=len(reps))
- print '1',c,c.shape
d = c.reshape(3, 4, 0)
- print '2',c,c.shape
e = d.repeat(3, 0)
- print '3',c,c.shape,e.shape
assert e.shape == (9, 4, 0)
def test_type(self):
@@ -2573,6 +2570,9 @@
a = array(range(100) + range(100) + range(100))
b = a.argsort()
assert (b[:3] == [0, 100, 200]).all()
+ a = array([[[]]]).reshape(3,4,0)
+ b = a.argsort()
+ assert b.size == 0
def test_argsort_random(self):
from numpypy import array
More information about the pypy-commit
mailing list