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

Function npyiter_iterindex_set

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

Source from the content-addressed store, hash-verified

1704}
1705
1706static int
1707npyiter_iterindex_set(
1708 NewNpyArrayIterObject *self, PyObject *value, void *NPY_UNUSED(ignored))
1709{
1710 npy_intp iterindex;
1711
1712 if (value == NULL) {
1713 PyErr_SetString(PyExc_AttributeError,
1714 "Cannot delete nditer iterindex");
1715 return -1;
1716 }
1717 if (self->iter == NULL) {
1718 PyErr_SetString(PyExc_ValueError,
1719 "Iterator is invalid");
1720 return -1;
1721 }
1722
1723 iterindex = PyLong_AsLong(value);
1724 if (error_converting(iterindex)) {
1725 return -1;
1726 }
1727 if (NpyIter_GotoIterIndex(self->iter, iterindex) != NPY_SUCCEED) {
1728 return -1;
1729 }
1730 self->started = 0;
1731 self->finished = 0;
1732
1733 /* If there is nesting, the nested iterators should be reset */
1734 if (npyiter_resetbasepointers(self) != NPY_SUCCEED) {
1735 return -1;
1736 }
1737
1738 return 0;
1739}
1740
1741static PyObject *
1742npyiter_iterrange_get(NewNpyArrayIterObject *self, void *NPY_UNUSED(ignored))

Callers

nothing calls this directly

Calls 2

NpyIter_GotoIterIndexFunction · 0.85

Tested by

no test coverage detected