| 1191 | } |
| 1192 | |
| 1193 | static PyObject * |
| 1194 | npyiter_reset(NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args)) |
| 1195 | { |
| 1196 | if (self->iter == NULL) { |
| 1197 | PyErr_SetString(PyExc_ValueError, |
| 1198 | "Iterator is invalid"); |
| 1199 | return NULL; |
| 1200 | } |
| 1201 | |
| 1202 | if (NpyIter_Reset(self->iter, NULL) != NPY_SUCCEED) { |
| 1203 | return NULL; |
| 1204 | } |
| 1205 | if (NpyIter_GetIterSize(self->iter) == 0) { |
| 1206 | self->started = 1; |
| 1207 | self->finished = 1; |
| 1208 | } |
| 1209 | else { |
| 1210 | self->started = 0; |
| 1211 | self->finished = 0; |
| 1212 | } |
| 1213 | |
| 1214 | if (self->get_multi_index == NULL && NpyIter_HasMultiIndex(self->iter)) { |
| 1215 | self->get_multi_index = NpyIter_GetGetMultiIndex(self->iter, NULL); |
| 1216 | } |
| 1217 | |
| 1218 | /* If there is nesting, the nested iterators should be reset */ |
| 1219 | if (npyiter_resetbasepointers(self) != NPY_SUCCEED) { |
| 1220 | return NULL; |
| 1221 | } |
| 1222 | |
| 1223 | Py_RETURN_NONE; |
| 1224 | } |
| 1225 | |
| 1226 | /* |
| 1227 | * Makes a copy of the iterator. Note that the nesting is not |
nothing calls this directly
no test coverage detected