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

Function PyArray_IterNew

numpy/core/src/multiarray/iterators.c:174–200  ·  view source on GitHub ↗

NUMPY_API * Get Iterator. */

Source from the content-addressed store, hash-verified

172 * Get Iterator.
173 */
174NPY_NO_EXPORT PyObject *
175PyArray_IterNew(PyObject *obj)
176{
177 /*
178 * Note that internally PyArray_RawIterBaseInit may be called directly on a
179 * statically allocated PyArrayIterObject.
180 */
181 PyArrayIterObject *it;
182 PyArrayObject *ao;
183
184 if (!PyArray_Check(obj)) {
185 PyErr_BadInternalCall();
186 return NULL;
187 }
188 ao = (PyArrayObject *)obj;
189
190 it = (PyArrayIterObject *)PyArray_malloc(sizeof(PyArrayIterObject));
191 PyObject_Init((PyObject *)it, &PyArrayIter_Type);
192 /* it = PyObject_New(PyArrayIterObject, &PyArrayIter_Type);*/
193 if (it == NULL) {
194 return NULL;
195 }
196
197 Py_INCREF(ao); /* PyArray_RawIterBaseInit steals a reference */
198 PyArray_RawIterBaseInit(it, ao);
199 return (PyObject *)it;
200}
201
202/*NUMPY_API
203 * Get Iterator broadcast to a particular shape

Callers 15

array_flat_getFunction · 0.85
array_flat_setFunction · 0.85
_getlist_pklFunction · 0.85
_setlist_pklFunction · 0.85
_vec_string_with_argsFunction · 0.85
_vec_string_no_argsFunction · 0.85
PyArray_INCREFFunction · 0.85
PyArray_IterAllButAxisFunction · 0.85
iter_subscript_intFunction · 0.85
iter_ass_sub_intFunction · 0.85
iter_ass_subscriptFunction · 0.85

Calls 1

PyArray_RawIterBaseInitFunction · 0.85

Tested by

no test coverage detected