Commits

Brian Kearns  committed c477a1c

fix scalar recordtype getitem

  • Participants
  • Parent commits bf10cd3

Comments (0)

Files changed (3)

File pypy/module/micronumpy/arrayimpl/scalar.py

         elif space.isinstance_w(w_idx, space.w_str):
             if self.dtype.is_record_type():
                 w_val = self.value.descr_getitem(space, w_idx)
-                assert isinstance(w_val, W_GenericBox)
-                return w_val.descr_ravel(space)
+                return convert_to_array(space, w_val)
         elif space.is_none(w_idx):
             new_shape = [1]
             arr = W_NDimArray.from_shape(space, new_shape, self.dtype)

File pypy/module/micronumpy/interp_boxes.py

         self.dtype = dtype
 
     def get_dtype(self, space):
-        return self.arr.dtype
+        return self.dtype
 
     def raw_str(self):
         return self.arr.dtype.itemtype.to_str(self)

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

         assert exc.value.message == "0-d arrays can't be indexed"
         exc = raises(ValueError, "arr['xx'] = 2")
         assert exc.value.message == "field named xx not found"
-        arr['y']
-        #assert arr['y'].shape == ()
-        #assert arr['y'][()][0] == 0
-        #assert arr['y'][()][0] == 0
+        assert arr['y'].dtype == a
+        assert arr['y'].shape == ()
+        #assert arr['y'][()]['x'] == 0
+        #assert arr['y'][()]['y'] == 0
         arr = zeros(3, dtype=b)
         arr[1]['x'] = 15
         assert arr[1]['x'] == 15