diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-12-08 02:54:38 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-12-08 02:54:38 +0000 |
commit | e3a1550ff1417599f68207f60ea622404d281178 (patch) | |
tree | 4106f27471edcd21005b830baea2858c85784922 /numpy/core/src/ufuncobject.c | |
parent | 9c5f0d85bc51b21650fb93657d4094e8f09b63b1 (diff) | |
download | numpy-e3a1550ff1417599f68207f60ea622404d281178.tar.gz |
Fix some problems with user-defined ufunc registration.
Diffstat (limited to 'numpy/core/src/ufuncobject.c')
-rw-r--r-- | numpy/core/src/ufuncobject.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/numpy/core/src/ufuncobject.c b/numpy/core/src/ufuncobject.c index 606cf1be8..f479fd5c4 100644 --- a/numpy/core/src/ufuncobject.c +++ b/numpy/core/src/ufuncobject.c @@ -652,19 +652,19 @@ static int _find_matching_userloop(PyObject *obj, int *arg_types, PyArray_SCALARKIND *scalars, PyUFuncGenericFunction *function, void **data, - int nargs) + int nargs, int nin) { PyUFunc_Loop1d *funcdata; int i; funcdata = (PyUFunc_Loop1d *)PyCObject_AsVoidPtr(obj); while (funcdata != NULL) { - for (i=0; i<nargs; i++) { + for (i=0; i<nin; i++) { if (!PyArray_CanCoerceScalar(arg_types[i], funcdata->arg_types[i], scalars[i])) break; } - if (i==nargs) { /* match found */ + if (i==nin) { /* match found */ *function = funcdata->func; *data = funcdata->data; /* Make sure actual arg_types supported @@ -901,7 +901,8 @@ select_types(PyUFuncObject *self, int *arg_types, data and argtypes */ ret = _find_matching_userloop(obj, arg_types, scalars, - function, data, self->nargs); + function, data, self->nargs, + self->nin); Py_DECREF(obj); return ret; } @@ -3493,7 +3494,7 @@ PyUFunc_RegisterLoopForType(PyUFuncObject *ufunc, /* If it's not there, then make one and return. */ if (cobj == NULL) { - cobj = PyCObject_FromVoidPtr((void *)function, + cobj = PyCObject_FromVoidPtr((void *)funcdata, _loop1d_list_free); if (cobj == NULL) goto fail; PyDict_SetItem(ufunc->userloops, key, cobj); |