diff options
author | Travis Oliphant <oliphant@enthought.com> | 2009-12-04 12:50:12 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2009-12-04 12:50:12 +0000 |
commit | 914c498abefb4f65e160cdf6b030ff8efe8b975c (patch) | |
tree | a620083cb16b7d8dd7dd9a2e50126e07c5196a1c /numpy | |
parent | e2fbec1c121e92d41322149f6c376adf2bf5346a (diff) | |
download | numpy-914c498abefb4f65e160cdf6b030ff8efe8b975c.tar.gz |
Fix #1175 by only returning NotImplemented in the special case of a 2-input and 1-output ufunc. Otherwise, a NotImplemented error is raised.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/umath/ufunc_object.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index f646957a6..1f90dba87 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -3520,17 +3520,16 @@ ufunc_generic_call(PyUFuncObject *self, PyObject *args, PyObject *kwds) } if (errval == -1) return NULL; - else { - /* - * PyErr_SetString(PyExc_TypeError,""); - * return NULL; - */ - /* This is expected by at least the ndarray rich_comparisons - to allow for additional handling for strings. - */ + else if (self->nin == 2 && self->nout == 1) { + /* To allow the other argument to be given a chance + */ Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } + else { + PyErr_SetString(PyExc_NotImplementedError, "Not implemented for this type"); + return NULL; + } } for (i = 0; i < self->nin; i++) { Py_DECREF(mps[i]); |