NUMPY_API * Removes multi-index support from an iterator. * * Returns NPY_SUCCEED or NPY_FAIL. */
| 163 | * Returns NPY_SUCCEED or NPY_FAIL. |
| 164 | */ |
| 165 | NPY_NO_EXPORT int |
| 166 | NpyIter_RemoveMultiIndex(NpyIter *iter) |
| 167 | { |
| 168 | npy_uint32 itflags; |
| 169 | |
| 170 | /* Make sure the iterator is reset */ |
| 171 | if (NpyIter_Reset(iter, NULL) != NPY_SUCCEED) { |
| 172 | return NPY_FAIL; |
| 173 | } |
| 174 | |
| 175 | itflags = NIT_ITFLAGS(iter); |
| 176 | if (itflags&NPY_ITFLAG_HASMULTIINDEX) { |
| 177 | if (NIT_ITERSIZE(iter) < 0) { |
| 178 | PyErr_SetString(PyExc_ValueError, "iterator is too large"); |
| 179 | return NPY_FAIL; |
| 180 | } |
| 181 | |
| 182 | NIT_ITFLAGS(iter) = itflags & ~NPY_ITFLAG_HASMULTIINDEX; |
| 183 | npyiter_coalesce_axes(iter); |
| 184 | } |
| 185 | |
| 186 | return NPY_SUCCEED; |
| 187 | } |
| 188 | |
| 189 | /*NUMPY_API |
| 190 | * Removes the inner loop handling (so HasExternalLoop returns true) |
no test coverage detected