| 738 | } |
| 739 | |
| 740 | static int |
| 741 | iter_ass_sub_int(PyArrayIterObject *self, PyArrayObject *ind, |
| 742 | PyArrayIterObject *val, int swap) |
| 743 | { |
| 744 | npy_intp num; |
| 745 | PyArrayIterObject *ind_it; |
| 746 | npy_intp counter; |
| 747 | PyArray_CopySwapFunc *copyswap; |
| 748 | |
| 749 | copyswap = PyArray_DESCR(self->ao)->f->copyswap; |
| 750 | if (PyArray_NDIM(ind) == 0) { |
| 751 | num = *((npy_intp *)PyArray_DATA(ind)); |
| 752 | if (check_and_adjust_index(&num, self->size, -1, NULL) < 0) { |
| 753 | return -1; |
| 754 | } |
| 755 | PyArray_ITER_GOTO1D(self, num); |
| 756 | copyswap(self->dataptr, val->dataptr, swap, self->ao); |
| 757 | return 0; |
| 758 | } |
| 759 | ind_it = (PyArrayIterObject *)PyArray_IterNew((PyObject *)ind); |
| 760 | if (ind_it == NULL) { |
| 761 | return -1; |
| 762 | } |
| 763 | counter = ind_it->size; |
| 764 | while (counter--) { |
| 765 | num = *((npy_intp *)(ind_it->dataptr)); |
| 766 | if (check_and_adjust_index(&num, self->size, -1, NULL) < 0) { |
| 767 | Py_DECREF(ind_it); |
| 768 | return -1; |
| 769 | } |
| 770 | PyArray_ITER_GOTO1D(self, num); |
| 771 | copyswap(self->dataptr, val->dataptr, swap, self->ao); |
| 772 | PyArray_ITER_NEXT(ind_it); |
| 773 | PyArray_ITER_NEXT(val); |
| 774 | if (val->index == val->size) { |
| 775 | PyArray_ITER_RESET(val); |
| 776 | } |
| 777 | } |
| 778 | Py_DECREF(ind_it); |
| 779 | return 0; |
| 780 | } |
| 781 | |
| 782 | NPY_NO_EXPORT int |
| 783 | iter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) |
no test coverage detected