Commits

mattip  committed dfe7494

fix translation

  • Participants
  • Parent commits 61f2c6a
  • Branches voidtype_strformat

Comments (0)

Files changed (1)

File pypy/module/micronumpy/types.py

         "Void arrays return a buffer object for item(),
          unless fields are defined, in which case a tuple is returned."
         '''
+        assert isinstance(item, interp_boxes.W_VoidBox)
         dt = item.arr.dtype
-        tpl =()
+        ret_unwrapped = []
         for name in dt.fieldnames:
             ofs, dtype = dt.fields[name]
             if isinstance(dtype.itemtype, VoidType):
             if isinstance (read_val, interp_boxes.W_StringBox):
                 # StringType returns a str
                 read_val = space.wrap(dtype.itemtype.to_str(read_val))
-            tpl = tpl + (read_val,)
-        if len(tpl) == 0:
+            ret_unwrapped = ret_unwrapped + [read_val,]
+        if len(ret_unwrapped) == 0:
             raise OperationError(space.w_NotImplementedError, space.wrap(
                     "item() for Void aray with no fields not implemented"))
-        return space.wrap(tpl)
+        return space.newtuple(ret_unwrapped)
 
 class RecordType(FlexibleType):
     T = lltype.Char