MCPcopy Create free account
hub / github.com/numpy/numpy / npyiter_itviews_get

Function npyiter_itviews_get

numpy/core/src/multiarray/nditer_pywrap.c:1458–1487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1456}
1457
1458static PyObject *
1459npyiter_itviews_get(NewNpyArrayIterObject *self, void *NPY_UNUSED(ignored))
1460{
1461 PyObject *ret;
1462
1463 npy_intp iop, nop;
1464
1465 if (self->iter == NULL) {
1466 PyErr_SetString(PyExc_ValueError,
1467 "Iterator is invalid");
1468 return NULL;
1469 }
1470 nop = NpyIter_GetNOp(self->iter);
1471
1472 ret = PyTuple_New(nop);
1473 if (ret == NULL) {
1474 return NULL;
1475 }
1476 for (iop = 0; iop < nop; ++iop) {
1477 PyArrayObject *view = NpyIter_GetIterView(self->iter, iop);
1478
1479 if (view == NULL) {
1480 Py_DECREF(ret);
1481 return NULL;
1482 }
1483 PyTuple_SET_ITEM(ret, iop, (PyObject *)view);
1484 }
1485
1486 return ret;
1487}
1488
1489static PyObject *
1490npyiter_next(NewNpyArrayIterObject *self)

Callers

nothing calls this directly

Calls 2

NpyIter_GetNOpFunction · 0.85
NpyIter_GetIterViewFunction · 0.85

Tested by

no test coverage detected