[pypy-commit] pypy default: A potential fix (hard to test, it does not show up in normal tests). Iterate
fijal
noreply at buildbot.pypy.org
Thu Sep 20 11:55:03 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r57401:ad39288627f6
Date: 2012-09-20 11:54 +0200
http://bitbucket.org/pypy/pypy/changeset/ad39288627f6/
Log: A potential fix (hard to test, it does not show up in normal tests).
Iterate until the index is exhausted, not the array, otherwise we
might run out of index.
diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py
--- a/pypy/module/micronumpy/loop.py
+++ b/pypy/module/micronumpy/loop.py
@@ -194,7 +194,7 @@
arr_iter = arr.create_iter()
index_iter = index.create_iter()
value_iter = value.create_iter()
- while not arr_iter.done():
+ while not index_iter.done():
if index_iter.getitem_bool():
arr_iter.setitem(value_iter.getitem())
value_iter.next()
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
@@ -1549,7 +1549,7 @@
def test_bool_array_index_setitem(self):
from numpypy import arange, array
b = arange(5)
- b[array([True, False, True])] = [20, 21]
+ b[array([True, False, True])] = [20, 21, 0, 0, 0, 0, 0]
assert (b == [20, 1, 21, 3, 4]).all()
raises(ValueError, "array([1, 2])[array([True, False, True])] = [1, 2, 3]")
More information about the pypy-commit
mailing list