* Add to l all the items which uniquely define a builtin type */
| 69 | * Add to l all the items which uniquely define a builtin type |
| 70 | */ |
| 71 | static int _array_descr_builtin(PyArray_Descr* descr, PyObject *l) |
| 72 | { |
| 73 | Py_ssize_t i; |
| 74 | PyObject *t, *item; |
| 75 | char nbyteorder = _normalize_byteorder(descr->byteorder); |
| 76 | |
| 77 | /* |
| 78 | * For builtin type, hash relies on : kind + byteorder + flags + |
| 79 | * type_num + elsize + alignment |
| 80 | */ |
| 81 | t = Py_BuildValue("(cccii)", descr->kind, nbyteorder, |
| 82 | descr->flags, descr->elsize, descr->alignment); |
| 83 | |
| 84 | for(i = 0; i < PyTuple_Size(t); ++i) { |
| 85 | item = PyTuple_GetItem(t, i); |
| 86 | if (item == NULL) { |
| 87 | PyErr_SetString(PyExc_SystemError, |
| 88 | "(Hash) Error while computing builtin hash"); |
| 89 | goto clean_t; |
| 90 | } |
| 91 | PyList_Append(l, item); |
| 92 | } |
| 93 | |
| 94 | Py_DECREF(t); |
| 95 | return 0; |
| 96 | |
| 97 | clean_t: |
| 98 | Py_DECREF(t); |
| 99 | return -1; |
| 100 | } |
| 101 | |
| 102 | /* |
| 103 | * Walk inside the fields and add every item which will be used for hashing |
no test coverage detected