Author: Maciej Fijalkowski <[email protected]>
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]")
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to