* Makes a copy of the iterator. Note that the nesting is not * copied. */
| 1228 | * copied. |
| 1229 | */ |
| 1230 | static PyObject * |
| 1231 | npyiter_copy(NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args)) |
| 1232 | { |
| 1233 | NewNpyArrayIterObject *iter; |
| 1234 | |
| 1235 | if (self->iter == NULL) { |
| 1236 | PyErr_SetString(PyExc_ValueError, |
| 1237 | "Iterator is invalid"); |
| 1238 | return NULL; |
| 1239 | } |
| 1240 | |
| 1241 | /* Allocate the iterator */ |
| 1242 | iter = (NewNpyArrayIterObject *)npyiter_new(&NpyIter_Type, NULL, NULL); |
| 1243 | if (iter == NULL) { |
| 1244 | return NULL; |
| 1245 | } |
| 1246 | |
| 1247 | /* Copy the C iterator */ |
| 1248 | iter->iter = NpyIter_Copy(self->iter); |
| 1249 | if (iter->iter == NULL) { |
| 1250 | Py_DECREF(iter); |
| 1251 | return NULL; |
| 1252 | } |
| 1253 | |
| 1254 | /* Cache some values for the member functions to use */ |
| 1255 | if (npyiter_cache_values(iter) < 0) { |
| 1256 | Py_DECREF(iter); |
| 1257 | return NULL; |
| 1258 | } |
| 1259 | |
| 1260 | iter->started = self->started; |
| 1261 | iter->finished = self->finished; |
| 1262 | |
| 1263 | return (PyObject *)iter; |
| 1264 | } |
| 1265 | |
| 1266 | static PyObject * |
| 1267 | npyiter_iternext(NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args)) |
nothing calls this directly
no test coverage detected