* Walk into subarray, and add items for hashing in l * * Return 0 on success */
| 191 | * Return 0 on success |
| 192 | */ |
| 193 | static int _array_descr_walk_subarray(PyArray_ArrayDescr* adescr, PyObject *l) |
| 194 | { |
| 195 | PyObject *item; |
| 196 | Py_ssize_t i; |
| 197 | int st; |
| 198 | |
| 199 | /* |
| 200 | * Add shape and descr itself to the list of object to hash |
| 201 | */ |
| 202 | if (PyTuple_Check(adescr->shape)) { |
| 203 | for(i = 0; i < PyTuple_Size(adescr->shape); ++i) { |
| 204 | item = PyTuple_GetItem(adescr->shape, i); |
| 205 | if (item == NULL) { |
| 206 | PyErr_SetString(PyExc_SystemError, |
| 207 | "(Hash) Error while getting shape item of subarray dtype ???"); |
| 208 | return -1; |
| 209 | } |
| 210 | PyList_Append(l, item); |
| 211 | } |
| 212 | } |
| 213 | else if (PyLong_Check(adescr->shape)) { |
| 214 | PyList_Append(l, adescr->shape); |
| 215 | } |
| 216 | else { |
| 217 | PyErr_SetString(PyExc_SystemError, |
| 218 | "(Hash) Shape of subarray dtype neither a tuple or int ???"); |
| 219 | return -1; |
| 220 | } |
| 221 | |
| 222 | Py_INCREF(adescr->base); |
| 223 | st = _array_descr_walk(adescr->base, l); |
| 224 | Py_DECREF(adescr->base); |
| 225 | |
| 226 | return st; |
| 227 | } |
| 228 | |
| 229 | /* |
| 230 | * 'Root' function to walk into a dtype. May be called recursively |
no test coverage detected