summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2021-07-22 13:59:58 -0700
committerSebastian Berg <sebastian@sipsolutions.net>2021-07-22 19:52:52 -0500
commit971185ebf980d12e0c4a85622a4482783b83fa40 (patch)
treea500fe4a6601deeac7e36be990a9f39e5455cf6c /numpy
parent23b3eea9a78a216fe6c031cee41b66b4aaf930da (diff)
downloadnumpy-971185ebf980d12e0c4a85622a4482783b83fa40.tar.gz
MAINT: Use the same pattern for the floating point error check
Co-authored-by: Matti Picus <matti.picus@gmail.com>
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/umath/ufunc_object.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index c50f69c09..a039fb8ce 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -1335,12 +1335,12 @@ try_trivial_single_output_loop(PyArrayMethod_Context *context,
NPY_END_THREADS;
NPY_AUXDATA_FREE(auxdata);
- if (flags & NPY_METH_NO_FLOATINGPOINT_ERRORS || res < 0) {
- return res;
+ if (res == 0 && !(flags & NPY_METH_NO_FLOATINGPOINT_ERRORS)) {
+ /* NOTE: We could check float errors even when `res < 0` */
+ const char *name = ufunc_get_name_cstr((PyUFuncObject *)context->caller);
+ res = _check_ufunc_fperr(errormask, extobj, name);
}
- /* NOTE: We could check float errors even when `res < 0` */
- const char *name = ufunc_get_name_cstr((PyUFuncObject *)context->caller);
- return _check_ufunc_fperr(errormask, extobj, name);
+ return res;
}
@@ -1574,8 +1574,6 @@ execute_ufunc_loop(PyArrayMethod_Context *context, int masked,
NPY_END_THREADS;
NPY_AUXDATA_FREE(auxdata);
- // TODO: use the same pattern as we changed to in the trivial-loop
- // have to dealloc the iterator, but can do that first.
if (res == 0 && !(flags & NPY_METH_NO_FLOATINGPOINT_ERRORS)) {
/* NOTE: We could check float errors even when `res < 0` */
const char *name = ufunc_get_name_cstr((PyUFuncObject *)context->caller);