summaryrefslogtreecommitdiff
path: root/scipy/base/src/ufuncobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'scipy/base/src/ufuncobject.c')
-rw-r--r--scipy/base/src/ufuncobject.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/scipy/base/src/ufuncobject.c b/scipy/base/src/ufuncobject.c
index ea3cf266c..ea1ec3bd4 100644
--- a/scipy/base/src/ufuncobject.c
+++ b/scipy/base/src/ufuncobject.c
@@ -602,11 +602,14 @@ select_types(PyUFuncObject *self, int *arg_types,
for (i=self->nin; i<self->nargs; i++) {
arg_types[i] = arg_types[0];
}
-
- key = PyInt_FromLong((long) arg_types[0]);
- if (key == NULL) return -1;
- obj = PyDict_GetItem(self->userloops, key);
- Py_DECREF(key);
+
+ obj = NULL;
+ if (self->userloops) {
+ key = PyInt_FromLong((long) arg_types[0]);
+ if (key == NULL) return -1;
+ obj = PyDict_GetItem(self->userloops, key);
+ Py_DECREF(key);
+ }
if (obj == NULL) {
PyErr_SetString(PyExc_TypeError,
"no registered loop for this " \