NUMPY_API * Get Iterator. */
| 172 | * Get Iterator. |
| 173 | */ |
| 174 | NPY_NO_EXPORT PyObject * |
| 175 | PyArray_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 |
no test coverage detected