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

Function npyiter_enable_external_loop

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

Source from the content-addressed store, hash-verified

1347}
1348
1349static PyObject *
1350npyiter_enable_external_loop(
1351 NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args))
1352{
1353 if (self->iter == NULL) {
1354 PyErr_SetString(PyExc_ValueError,
1355 "Iterator is invalid");
1356 return NULL;
1357 }
1358
1359 NpyIter_EnableExternalLoop(self->iter);
1360 /* EnableExternalLoop invalidates cached values */
1361 npyiter_cache_values(self);
1362 /* EnableExternalLoop also resets the iterator */
1363 if (NpyIter_GetIterSize(self->iter) == 0) {
1364 self->started = 1;
1365 self->finished = 1;
1366 }
1367 else {
1368 self->started = 0;
1369 self->finished = 0;
1370 }
1371
1372 Py_RETURN_NONE;
1373}
1374
1375static PyObject *
1376npyiter_debug_print(NewNpyArrayIterObject *self, PyObject *NPY_UNUSED(args))

Callers

nothing calls this directly

Calls 3

npyiter_cache_valuesFunction · 0.85
NpyIter_GetIterSizeFunction · 0.85

Tested by

no test coverage detected