* Handler which uses the default `np.errstate` given that `fpe_errors` is * already set. `fpe_errors` is typically the (nonzero) result of * `npy_get_floatstatus_barrier`. * * Returns -1 on failure (an error was raised) and 0 on success. */
| 274 | * Returns -1 on failure (an error was raised) and 0 on success. |
| 275 | */ |
| 276 | NPY_NO_EXPORT int |
| 277 | PyUFunc_GiveFloatingpointErrors(const char *name, int fpe_errors) |
| 278 | { |
| 279 | int bufsize, errmask; |
| 280 | PyObject *errobj; |
| 281 | |
| 282 | if (PyUFunc_GetPyValues((char *)name, &bufsize, &errmask, |
| 283 | &errobj) < 0) { |
| 284 | return -1; |
| 285 | } |
| 286 | int first = 1; |
| 287 | if (PyUFunc_handlefperr(errmask, errobj, fpe_errors, &first)) { |
| 288 | Py_XDECREF(errobj); |
| 289 | return -1; |
| 290 | } |
| 291 | Py_XDECREF(errobj); |
| 292 | return 0; |
| 293 | } |
| 294 | |
| 295 | |
| 296 | /* |
no test coverage detected