| 1538 | } |
| 1539 | |
| 1540 | static PyObject * |
| 1541 | npyiter_multi_index_get(NewNpyArrayIterObject *self, void *NPY_UNUSED(ignored)) |
| 1542 | { |
| 1543 | npy_intp ndim, multi_index[NPY_MAXDIMS]; |
| 1544 | |
| 1545 | if (self->iter == NULL || self->finished) { |
| 1546 | PyErr_SetString(PyExc_ValueError, |
| 1547 | "Iterator is past the end"); |
| 1548 | return NULL; |
| 1549 | } |
| 1550 | |
| 1551 | if (self->get_multi_index != NULL) { |
| 1552 | ndim = NpyIter_GetNDim(self->iter); |
| 1553 | self->get_multi_index(self->iter, multi_index); |
| 1554 | return PyArray_IntTupleFromIntp(ndim, multi_index); |
| 1555 | } |
| 1556 | else { |
| 1557 | if (!NpyIter_HasMultiIndex(self->iter)) { |
| 1558 | PyErr_SetString(PyExc_ValueError, |
| 1559 | "Iterator is not tracking a multi-index"); |
| 1560 | return NULL; |
| 1561 | } |
| 1562 | else if (NpyIter_HasDelayedBufAlloc(self->iter)) { |
| 1563 | PyErr_SetString(PyExc_ValueError, |
| 1564 | "Iterator construction used delayed buffer allocation, " |
| 1565 | "and no reset has been done yet"); |
| 1566 | return NULL; |
| 1567 | } |
| 1568 | else { |
| 1569 | PyErr_SetString(PyExc_ValueError, |
| 1570 | "Iterator is in an invalid state"); |
| 1571 | return NULL; |
| 1572 | } |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | static int |
| 1577 | npyiter_multi_index_set( |
nothing calls this directly
no test coverage detected