summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorJay Bourque <jay.bourque@continuum.io>2012-11-15 13:11:24 -0600
committerJay Bourque <jay.bourque@continuum.io>2013-04-26 12:41:10 -0500
commit877d0479afa2117cc65f4282dacd654fb09f25bc (patch)
tree9304233a130450ec1f2a8453c7fe0363be2d6d04 /numpy/core
parentf8a21eff6a93022f31e995b41d6fe28f16e39a12 (diff)
downloadnumpy-877d0479afa2117cc65f4282dacd654fb09f25bc.tar.gz
Fix for ufuncs with built in input operands and custom output operands
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/src/umath/ufunc_type_resolution.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/numpy/core/src/umath/ufunc_type_resolution.c b/numpy/core/src/umath/ufunc_type_resolution.c
index 5b090e88e..8344d73e5 100644
--- a/numpy/core/src/umath/ufunc_type_resolution.c
+++ b/numpy/core/src/umath/ufunc_type_resolution.c
@@ -1179,7 +1179,13 @@ find_userloop(PyUFuncObject *ufunc,
/* Use this to try to avoid repeating the same userdef loop search */
int last_userdef = -1;
- for (i = 0; i < nin; ++i) {
+ for (i = 0; i < nargs; ++i) {
+
+ /* no more ufunc arguments to check */
+ if (dtypes[i] == NULL) {
+ break;
+ }
+
int type_num = dtypes[i]->type_num;
if (type_num != last_userdef && PyTypeNum_ISUSERDEF(type_num)) {
PyObject *key, *obj;
@@ -1581,13 +1587,19 @@ linear_search_userloop_type_resolver(PyUFuncObject *self,
char *out_err_src_typecode,
char *out_err_dst_typecode)
{
- npy_intp i, nin = self->nin;
+ npy_intp i, nop = self->nin + self->nout;
PyUFunc_Loop1d *funcdata;
/* Use this to try to avoid repeating the same userdef loop search */
int last_userdef = -1;
- for (i = 0; i < nin; ++i) {
+ for (i = 0; i < nop; ++i) {
+
+ /* no more ufunc arguments to check */
+ if (op[i] == NULL) {
+ break;
+ }
+
int type_num = PyArray_DESCR(op[i])->type_num;
if (type_num != last_userdef && PyTypeNum_ISUSERDEF(type_num)) {
PyObject *key, *obj;