| 1389 | npyiter_seq_item(NewNpyArrayIterObject *self, Py_ssize_t i); |
| 1390 | |
| 1391 | static PyObject * |
| 1392 | npyiter_value_get(NewNpyArrayIterObject *self, void *NPY_UNUSED(ignored)) |
| 1393 | { |
| 1394 | PyObject *ret; |
| 1395 | |
| 1396 | npy_intp iop, nop; |
| 1397 | |
| 1398 | if (self->iter == NULL || self->finished) { |
| 1399 | PyErr_SetString(PyExc_ValueError, |
| 1400 | "Iterator is past the end"); |
| 1401 | return NULL; |
| 1402 | } |
| 1403 | |
| 1404 | nop = NpyIter_GetNOp(self->iter); |
| 1405 | |
| 1406 | /* Return an array or tuple of arrays with the values */ |
| 1407 | if (nop == 1) { |
| 1408 | ret = npyiter_seq_item(self, 0); |
| 1409 | } |
| 1410 | else { |
| 1411 | ret = PyTuple_New(nop); |
| 1412 | if (ret == NULL) { |
| 1413 | return NULL; |
| 1414 | } |
| 1415 | for (iop = 0; iop < nop; ++iop) { |
| 1416 | PyObject *a = npyiter_seq_item(self, iop); |
| 1417 | if (a == NULL) { |
| 1418 | Py_DECREF(ret); |
| 1419 | return NULL; |
| 1420 | } |
| 1421 | PyTuple_SET_ITEM(ret, iop, a); |
| 1422 | } |
| 1423 | } |
| 1424 | |
| 1425 | return ret; |
| 1426 | } |
| 1427 | |
| 1428 | static PyObject * |
| 1429 | npyiter_operands_get(NewNpyArrayIterObject *self, void *NPY_UNUSED(ignored)) |
no test coverage detected