summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-07-03 08:49:26 +0100
committerEric Wieser <wieser.eric@gmail.com>2017-07-03 09:00:28 +0100
commit13978dd80c152ca53c8a8b344f59be86a4bd9f44 (patch)
tree10c2409b125f5ff1b45d182b28b57554a4f29cdd
parent7844860e1b05862e9964900c39dd7e709979d4b5 (diff)
downloadnumpy-13978dd80c152ca53c8a8b344f59be86a4bd9f44.tar.gz
MAINT: Use a for loop to traverse the linked list
This avoids bugs like gh-9351 being introduced later
-rw-r--r--numpy/core/src/umath/ufunc_type_resolution.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/numpy/core/src/umath/ufunc_type_resolution.c b/numpy/core/src/umath/ufunc_type_resolution.c
index 8e0a0f475..b7e12f50f 100644
--- a/numpy/core/src/umath/ufunc_type_resolution.c
+++ b/numpy/core/src/umath/ufunc_type_resolution.c
@@ -1726,8 +1726,9 @@ linear_search_userloop_type_resolver(PyUFuncObject *self,
if (obj == NULL) {
continue;
}
- funcdata = (PyUFunc_Loop1d *)NpyCapsule_AsVoidPtr(obj);
- while (funcdata != NULL) {
+ for (funcdata = (PyUFunc_Loop1d *)NpyCapsule_AsVoidPtr(obj);
+ funcdata != NULL;
+ funcdata = funcdata->next) {
int *types = funcdata->arg_types;
switch (ufunc_loop_matches(self, op,
input_casting, output_casting,
@@ -1743,8 +1744,6 @@ linear_search_userloop_type_resolver(PyUFuncObject *self,
set_ufunc_loop_data_types(self, op, out_dtype, types, funcdata->arg_dtypes);
return 1;
}
-
- funcdata = funcdata->next;
}
}
}