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

Function npyiter_index_get

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

Source from the content-addressed store, hash-verified

1631}
1632
1633static PyObject *
1634npyiter_index_get(NewNpyArrayIterObject *self, void *NPY_UNUSED(ignored))
1635{
1636 if (self->iter == NULL || self->finished) {
1637 PyErr_SetString(PyExc_ValueError,
1638 "Iterator is past the end");
1639 return NULL;
1640 }
1641
1642 if (NpyIter_HasIndex(self->iter)) {
1643 npy_intp ind = *NpyIter_GetIndexPtr(self->iter);
1644 return PyLong_FromLong(ind);
1645 }
1646 else {
1647 PyErr_SetString(PyExc_ValueError,
1648 "Iterator does not have an index");
1649 return NULL;
1650 }
1651}
1652
1653static int
1654npyiter_index_set(

Callers

nothing calls this directly

Calls 2

NpyIter_HasIndexFunction · 0.85
NpyIter_GetIndexPtrFunction · 0.85

Tested by

no test coverage detected