[pypy-commit] pypy default: fix array setitem with ellipsis
bdkearns
noreply at buildbot.pypy.org
Thu Feb 27 11:14:33 CET 2014
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r69501:67b371c67638
Date: 2014-02-27 04:51 -0500
http://bitbucket.org/pypy/pypy/changeset/67b371c67638/
Log: fix array setitem with ellipsis
diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py
--- a/pypy/module/micronumpy/ndarray.py
+++ b/pypy/module/micronumpy/ndarray.py
@@ -223,7 +223,10 @@
self.implementation.setitem_index(space, index_list, w_value)
def descr_setitem(self, space, w_idx, w_value):
- if isinstance(w_idx, W_NDimArray) and w_idx.get_dtype().is_bool() \
+ if space.is_w(w_idx, space.w_Ellipsis):
+ self.implementation.setslice(space, convert_to_array(space, w_value))
+ return
+ elif isinstance(w_idx, W_NDimArray) and w_idx.get_dtype().is_bool() \
and len(w_idx.get_shape()) > 0:
self.setitem_filter(space, w_idx, convert_to_array(space, w_value))
return
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
@@ -2303,12 +2303,12 @@
import numpy as np
a = np.array(1.5)
assert a[...] is a
- #a[...] = 2.5
- #assert a == 2.5
+ a[...] = 2.5
+ assert a == 2.5
a = np.array([1, 2, 3])
assert a[...] is a
- #a[...] = 4
- #assert (a == [4, 4, 4]).all()
+ a[...] = 4
+ assert (a == [4, 4, 4]).all()
class AppTestNumArrayFromBuffer(BaseNumpyAppTest):
More information about the pypy-commit
mailing list