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

Function npyiter_next

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

Source from the content-addressed store, hash-verified

1487}
1488
1489static PyObject *
1490npyiter_next(NewNpyArrayIterObject *self)
1491{
1492 if (self->iter == NULL || self->iternext == NULL ||
1493 self->finished) {
1494 return NULL;
1495 }
1496
1497 /*
1498 * Use the started flag for the Python iteration protocol to work
1499 * when buffering is enabled.
1500 */
1501 if (self->started) {
1502 if (!self->iternext(self->iter)) {
1503 /*
1504 * A casting error may be set here (or no error causing a
1505 * StopIteration). Buffers may only be cleaned up later.
1506 */
1507 self->finished = 1;
1508 return NULL;
1509 }
1510
1511 /* If there is nesting, the nested iterators should be reset */
1512 if (npyiter_resetbasepointers(self) != NPY_SUCCEED) {
1513 return NULL;
1514 }
1515 }
1516 self->started = 1;
1517
1518 return npyiter_value_get(self, NULL);
1519};
1520
1521static PyObject *
1522npyiter_shape_get(NewNpyArrayIterObject *self, void *NPY_UNUSED(ignored))

Callers

nothing calls this directly

Calls 2

npyiter_value_getFunction · 0.85

Tested by

no test coverage detected