[pypy-commit] pypy default: cleanup

bdkearns noreply at buildbot.pypy.org
Fri Feb 28 07:32:03 CET 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r69537:c7852a2bf25d
Date: 2014-02-28 01:27 -0500
http://bitbucket.org/pypy/pypy/changeset/c7852a2bf25d/

Log:	cleanup

diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -1740,10 +1740,11 @@
         a = array([(1, 2)], dtype=[('a', 'int64'), ('b', 'int64')])[0]
         assert a.shape == ()
         assert a.view('S16') == '\x01' + '\x00' * 7 + '\x02'
-        a = array(2, dtype='int64')
-        b = a.view('complex64')
+        a = array(2, dtype='<i8')
+        b = a.view('<c8')
         assert 0 < b.real < 1
-        assert b.imag == 0
+        assert b.real.tostring() == '\x02\x00\x00\x00'
+        assert b.imag.tostring() == '\x00' * 4
 
     def test_array_view(self):
         from numpypy import array, dtype
diff --git a/pypy/module/micronumpy/ufuncs.py b/pypy/module/micronumpy/ufuncs.py
--- a/pypy/module/micronumpy/ufuncs.py
+++ b/pypy/module/micronumpy/ufuncs.py
@@ -164,13 +164,13 @@
     def reduce(self, space, w_obj, w_axis, keepdims=False, out=None, dtype=None,
                cumulative=False):
         if self.argcount != 2:
-            raise OperationError(space.w_ValueError, space.wrap("reduce only "
-                "supported for binary functions"))
+            raise oefmt(space.w_ValueError,
+                        "reduce only supported for binary functions")
         assert isinstance(self, W_Ufunc2)
         obj = convert_to_array(space, w_obj)
         if obj.get_dtype().is_flexible():
-            raise OperationError(space.w_TypeError,
-                      space.wrap('cannot perform reduce with flexible type'))
+            raise oefmt(space.w_TypeError,
+                        "cannot perform reduce with flexible type")
         obj_shape = obj.get_shape()
         if obj.is_scalar():
             return obj.get_scalar_value()


More information about the pypy-commit mailing list