MCPcopy Create free account
hub / github.com/numpy/numpy / ufunc_update_use_defaults

Function ufunc_update_use_defaults

numpy/core/src/umath/extobj.c:27–50  ·  view source on GitHub ↗

* This is a strategy to buy a little speed up and avoid the dictionary * look-up in the default case. It should work in the presence of * threads. If it is deemed too complicated or it doesn't actually work * it could be taken out. */

Source from the content-addressed store, hash-verified

25 * it could be taken out.
26 */
27NPY_NO_EXPORT int
28ufunc_update_use_defaults(void)
29{
30 PyObject *errobj = NULL;
31 int errmask, bufsize;
32 int res;
33
34 PyUFunc_NUM_NODEFAULTS += 1;
35 res = PyUFunc_GetPyValues("test", &bufsize, &errmask, &errobj);
36 PyUFunc_NUM_NODEFAULTS -= 1;
37 if (res < 0) {
38 Py_XDECREF(errobj);
39 return -1;
40 }
41 if ((errmask != UFUNC_ERR_DEFAULT) || (bufsize != NPY_BUFSIZE)
42 || (PyTuple_GET_ITEM(errobj, 1) != Py_None)) {
43 PyUFunc_NUM_NODEFAULTS += 1;
44 }
45 else if (PyUFunc_NUM_NODEFAULTS > 0) {
46 PyUFunc_NUM_NODEFAULTS -= 1;
47 }
48 Py_XDECREF(errobj);
49 return 0;
50}
51#endif
52
53/*

Callers 1

ufunc_seterrFunction · 0.85

Calls 1

PyUFunc_GetPyValuesFunction · 0.85

Tested by

no test coverage detected