Commits

mattip  committed 30d046a

fix wrong type in error message (amaury, arigato)

  • Participants
  • Parent commits 0e80ff8

Comments (0)

Files changed (2)

File pypy/module/micronumpy/interp_dtype.py

             return dtype
         if w_dtype is dtype.w_box_type:
             return dtype
-    raise OperationError(space.w_TypeError, space.wrap("data type %r not understood" % w_dtype))
+    typename = space.type(w_dtype).getname(space)
+    raise OperationError(space.w_TypeError, space.wrap(
+                             "data type not understood (value of type " +
+                             "%s not expected here)" % typename))
 
 W_Dtype.typedef = TypeDef("dtype",
     __module__ = "numpypy",

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

 
         assert dtype(None) is dtype(float)
 
-        raises(TypeError, dtype, 1042)
+        exc = raises(TypeError, dtype, (1, 2))
+        assert 'data type not understood' in str(exc.value)
         raises(KeyError, 'dtype(int)["asdasd"]')
 
     def test_dtype_eq(self):