* Checks if the object in descr is the default 'descr' member for the * __array_interface__ dictionary with 'typestr' member typestr. */
| 2086 | * __array_interface__ dictionary with 'typestr' member typestr. |
| 2087 | */ |
| 2088 | NPY_NO_EXPORT int |
| 2089 | _is_default_descr(PyObject *descr, PyObject *typestr) { |
| 2090 | if (!PyList_Check(descr) || PyList_GET_SIZE(descr) != 1) { |
| 2091 | return 0; |
| 2092 | } |
| 2093 | PyObject *tuple = PyList_GET_ITEM(descr, 0); |
| 2094 | if (!(PyTuple_Check(tuple) && PyTuple_GET_SIZE(tuple) == 2)) { |
| 2095 | return 0; |
| 2096 | } |
| 2097 | PyObject *name = PyTuple_GET_ITEM(tuple, 0); |
| 2098 | if (!(PyUnicode_Check(name) && PyUnicode_GetLength(name) == 0)) { |
| 2099 | return 0; |
| 2100 | } |
| 2101 | PyObject *typestr2 = PyTuple_GET_ITEM(tuple, 1); |
| 2102 | return PyObject_RichCompareBool(typestr, typestr2, Py_EQ); |
| 2103 | } |
| 2104 | |
| 2105 | |
| 2106 | /*NUMPY_API*/ |
no outgoing calls
no test coverage detected