Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r57698:bb0006ff2df4
Date: 2012-10-01 16:25 +0200
http://bitbucket.org/pypy/pypy/changeset/bb0006ff2df4/
Log: a test and a fix
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
@@ -129,6 +129,8 @@
self._prepare_array_index(space, w_index)
shape = res_shape + self.get_shape()[len(indexes):]
res = W_NDimArray.from_shape(shape, self.get_dtype(), self.get_order())
+ if not self.get_size() and not res.get_size():
+ return res
return loop.getitem_array_int(space, self, res, iter_shape, indexes,
prefix)
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
@@ -1999,6 +1999,7 @@
def test_int_array_index(self):
from _numpypy import array
+ assert (array([])[[]] == []).all()
a = array([[1, 2], [3, 4], [5, 6]])
assert (a[slice(0, 3), [0, 0]] == [[1, 1], [3, 3], [5, 5]]).all()
assert (a[array([0, 2]), slice(0, 2)] == [[1, 2], [5, 6]]).all()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit