| 780 | } |
| 781 | |
| 782 | NPY_NO_EXPORT int |
| 783 | iter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) |
| 784 | { |
| 785 | PyArrayObject *arrval = NULL; |
| 786 | PyArrayIterObject *val_it = NULL; |
| 787 | PyArray_Descr *type; |
| 788 | PyArray_Descr *indtype = NULL; |
| 789 | int swap, retval = -1; |
| 790 | npy_intp start, step_size; |
| 791 | npy_intp n_steps; |
| 792 | PyObject *obj = NULL; |
| 793 | PyArray_CopySwapFunc *copyswap; |
| 794 | |
| 795 | |
| 796 | if (val == NULL) { |
| 797 | PyErr_SetString(PyExc_TypeError, |
| 798 | "Cannot delete iterator elements"); |
| 799 | return -1; |
| 800 | } |
| 801 | |
| 802 | if (PyArray_FailUnlessWriteable(self->ao, "underlying array") < 0) |
| 803 | return -1; |
| 804 | |
| 805 | if (ind == Py_Ellipsis) { |
| 806 | ind = PySlice_New(NULL, NULL, NULL); |
| 807 | retval = iter_ass_subscript(self, ind, val); |
| 808 | Py_DECREF(ind); |
| 809 | return retval; |
| 810 | } |
| 811 | |
| 812 | if (PyTuple_Check(ind)) { |
| 813 | int len; |
| 814 | len = PyTuple_GET_SIZE(ind); |
| 815 | if (len > 1) { |
| 816 | goto finish; |
| 817 | } |
| 818 | ind = PyTuple_GET_ITEM(ind, 0); |
| 819 | } |
| 820 | |
| 821 | type = PyArray_DESCR(self->ao); |
| 822 | |
| 823 | /* |
| 824 | * Check for Boolean -- this is first because |
| 825 | * Bool is a subclass of Int |
| 826 | */ |
| 827 | if (PyBool_Check(ind)) { |
| 828 | retval = 0; |
| 829 | if (PyObject_IsTrue(ind)) { |
| 830 | retval = PyArray_Pack( |
| 831 | PyArray_DESCR(self->ao), self->dataptr, val); |
| 832 | } |
| 833 | goto finish; |
| 834 | } |
| 835 | |
| 836 | if (PySequence_Check(ind) || PySlice_Check(ind)) { |
| 837 | goto skip; |
| 838 | } |
| 839 | start = PyArray_PyIntAsIntp(ind); |
nothing calls this directly
no test coverage detected