Commits

Maciej Fijalkowski  committed 4209800

take for 1d arrays

  • Participants
  • Parent commits e96e525
  • Branches numpy-back-to-applevel

Comments (0)

Files changed (2)

File pypy/module/micronumpy/interp_numarray.py

         res = W_NDimArray(size, res_shape[:], self.dtype, self.order)
         res_i = res.create_iter()
         longdtype = interp_dtype.get_dtype_cache(space).w_longdtype
+        shapelen = len(index.shape)
         while not index_i.done():
             w_item = index.getitem(index_i.offset).convert_to(longdtype)
-            import pdb
-            pdb.set_trace()
             res.setitem(res_i.offset, self.descr_getitem(space, w_item))
-            index_i = index_i.next()
-            res_i = res_i.next()
+            index_i = index_i.next(shapelen)
+            res_i = res_i.next(shapelen)
         return res
 
 def convert_to_array(space, w_obj):

File pypy/module/micronumpy/test/test_numarray.py

 
     def test_take(self):
         from _numpypy import arange
-        assert(arange(10).take([1, 2, 1, 1]) == [1, 2, 1, 1])
+        assert (arange(10).take([1, 2, 1, 1]) == [1, 2, 1, 1]).all()
 
 class AppTestSupport(BaseNumpyAppTest):
     def setup_class(cls):