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

Function register_fail

numpy/core/src/umath/_struct_ufunc_tests.c:54–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54static PyObject*
55register_fail(PyObject* NPY_UNUSED(self), PyObject* NPY_UNUSED(args))
56{
57 PyObject *add_triplet;
58 PyObject *dtype_dict;
59 PyArray_Descr *dtype;
60 PyArray_Descr *dtypes[3];
61 int retval;
62
63 add_triplet = PyUFunc_FromFuncAndData(NULL, NULL, NULL, 0, 2, 1,
64 PyUFunc_None, "add_triplet",
65 "add_triplet_docstring", 0);
66
67 dtype_dict = Py_BuildValue("[(s, s), (s, s), (s, s)]",
68 "f0", "u8", "f1", "u8", "f2", "u8");
69 PyArray_DescrConverter(dtype_dict, &dtype);
70 Py_DECREF(dtype_dict);
71
72 dtypes[0] = dtype;
73 dtypes[1] = dtype;
74 dtypes[2] = dtype;
75
76 retval = PyUFunc_RegisterLoopForDescr((PyUFuncObject *)add_triplet,
77 dtype,
78 &add_uint64_triplet,
79 dtypes,
80 NULL);
81
82 if (retval < 0) {
83 Py_DECREF(add_triplet);
84 Py_DECREF(dtype);
85 return NULL;
86 }
87 retval = PyUFunc_RegisterLoopForDescr((PyUFuncObject *)add_triplet,
88 dtype,
89 &add_uint64_triplet,
90 dtypes,
91 NULL);
92 Py_DECREF(add_triplet);
93 Py_DECREF(dtype);
94 if (retval < 0) {
95 return NULL;
96 }
97 Py_RETURN_NONE;
98}
99
100static PyMethodDef StructUfuncTestMethods[] = {
101 {"register_fail",

Callers

nothing calls this directly

Calls 3

PyUFunc_FromFuncAndDataFunction · 0.85
PyArray_DescrConverterFunction · 0.85

Tested by

no test coverage detected