diff options
author | Mark Wiebe <mwiebe@enthought.com> | 2011-08-03 13:57:13 -0500 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2011-08-27 07:26:51 -0600 |
commit | de1feee7ff45f7575e1465ee0b637aa31bba8b9a (patch) | |
tree | 4222320cfff21e6e24eb7819f7dd2f467c8cb54d /numpy/core | |
parent | 0e5fb25980859a44fed8a1b5ddc85075d28c7883 (diff) | |
download | numpy-de1feee7ff45f7575e1465ee0b637aa31bba8b9a.tar.gz |
ENH: missingdata: Fix the remaining scipy errors
Except for 4 iterative convergence errors I always see in scipy anyway.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/umath/ufunc_object.c | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_ufunc.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index 500c72620..6cf5fbbba 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -4085,7 +4085,7 @@ PyUFunc_GenericReduction(PyUFuncObject *self, PyObject *args, } /* Otherwise return the array unscathed */ else { - return (PyObject *)mp; + return PyArray_Return(mp); } } PyErr_Format(PyExc_TypeError, "cannot %s on a scalar", diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py index 69f2b3c74..be7dae8eb 100644 --- a/numpy/core/tests/test_ufunc.py +++ b/numpy/core/tests/test_ufunc.py @@ -515,6 +515,12 @@ class TestUfunc(TestCase): assert_equal(np.max(3, axis=0), 3) assert_equal(np.min(2.5, axis=0), 2.5) + # Make sure that scalars are coming out from this operation + assert_(type(np.prod(np.float32(2.5), axis=0)) is np.float32) + assert_(type(np.sum(np.float32(2.5), axis=0)) is np.float32) + assert_(type(np.max(np.float32(2.5), axis=0)) is np.float32) + assert_(type(np.min(np.float32(2.5), axis=0)) is np.float32) + def test_casting_out_param(self): # Test that it's possible to do casts on output a = np.ones((200,100), np.int64) |