[pypy-commit] pypy default: Don't attempt to handle complex indices on the fast path
rlamy
noreply at buildbot.pypy.org
Mon Jul 20 19:32:18 CEST 2015
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch:
Changeset: r78616:e549d8109029
Date: 2015-07-20 18:32 +0100
http://bitbucket.org/pypy/pypy/changeset/e549d8109029/
Log: Don't attempt to handle complex indices on the fast path
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
@@ -187,17 +187,8 @@
raise ArrayArgumentException
if space.isinstance_w(w_idx, space.w_tuple):
view_w = space.fixedview(w_idx)
- if len(view_w) < shape_len:
+ if len(view_w) != shape_len:
raise IndexError
- if len(view_w) > shape_len:
- # we can allow for one extra None
- count = len(view_w)
- for w_item in view_w:
- if space.is_w(w_item, space.w_None):
- count -= 1
- if count == shape_len:
- raise IndexError # but it's still not a single item
- raise oefmt(space.w_IndexError, "invalid index")
# check for arrays
for w_item in view_w:
if (isinstance(w_item, W_NDimArray) or
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
@@ -2479,6 +2479,7 @@
assert a[...].base is a
a[...] = 4
assert (a == [4, 4, 4]).all()
+ assert a[..., 0] == 4
b = np.arange(24).reshape(2,3,4)
b[...] = 100
More information about the pypy-commit
mailing list