-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Closed
Description
The lines at
numpy/numpy/core/src/umath/extobj.c
Lines 40 to 46 in 018fb37
| if ((errmask != UFUNC_ERR_DEFAULT) || (bufsize != NPY_BUFSIZE) | |
| || (PyTuple_GET_ITEM(errobj, 1) != Py_None)) { | |
| PyUFunc_NUM_NODEFAULTS += 1; | |
| } | |
| else if (PyUFunc_NUM_NODEFAULTS > 0) { | |
| PyUFunc_NUM_NODEFAULTS -= 1; | |
| } |
are wrong. Before getting that error, the previous error may already have been default (or may not have been set at all). In that case, a "num-defaults" is decremented. This logic really needs to check the previous state more than the current, I think.
This can be triggered using only one thread, even with np.errstate:
arr = np.arange(3)
with np.errstate(all="raise"):
with np.errstate("all="ignore"):
pass
# gives the correct value, but uses the lookup (using threads, the opposite will be possible
# -- although not super likely -- using the "defaults" even though the defaults are not set.
np.add(arr, arr)
Reactions are currently unavailable