Author: mattip <[email protected]>
Branch: numpypy-complex2
Changeset: r57309:a993ef4b7d2b
Date: 2012-09-13 01:45 +0300
http://bitbucket.org/pypy/pypy/changeset/a993ef4b7d2b/

Log:    do not box twice, note that numpy.real, numpy.imag are not
        sufficiently tested

diff --git a/pypy/module/micronumpy/test/test_ufuncs.py 
b/pypy/module/micronumpy/test/test_ufuncs.py
--- a/pypy/module/micronumpy/test/test_ufuncs.py
+++ b/pypy/module/micronumpy/test/test_ufuncs.py
@@ -1019,7 +1019,7 @@
             assert repr(abs(complex(float('nan'), float('nan')))) == 'nan'
 
         assert False, 'untested: ' + \
-                     'floor, ceil, trunc, ' + \
+                     'floor, ceil, trunc, numpy.real. numpy.imag' + \
                      'exp2, expm1, isnan, isinf, isneginf, isposinf, ' + \
                      'isfinite, radians, degrees, log2, log1p, ' + \
                      'logaddexp, npy_log2_1p, logaddexp2'
@@ -1103,9 +1103,9 @@
                            float(exp_real), float(exp_imag),
                            flags
                           )
-        for complex_, abs_err, testcases in \
-                ((np.complex64,  5e-32,  self.testcases64), 
+        for complex_, abs_err, testcases in (\
                  (np.complex128, 5e-323, self.testcases128),
+                 (np.complex64,  5e-32,  self.testcases64), 
                 ):
             for id, fn, ar, ai, er, ei, flags in parse_testfile(testcases):
                 arg = complex_(complex(ar, ai))
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -1052,15 +1052,15 @@
 
     @complex_to_real_unary_op
     def real(self, v):
-        return self.RealBoxType(v.real)
+        return v.real
 
     @complex_to_real_unary_op
     def imag(self, v):
-        return self.RealBoxType(v.imag)
+        return v.imag
 
     @complex_to_real_unary_op
     def abs(self, v):
-        return self.RealBoxType(rcomplex.c_abs(v[0], v[1]))
+        return rcomplex.c_abs(v[0], v[1])
 
     @raw_unary_op
     def isnan(self, v):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to