diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/nditer_api.c | 6 | ||||
-rw-r--r-- | numpy/core/src/umath/ufunc_object.c | 37 |
2 files changed, 0 insertions, 43 deletions
diff --git a/numpy/core/src/multiarray/nditer_api.c b/numpy/core/src/multiarray/nditer_api.c index da3c85ae0..f2bc23715 100644 --- a/numpy/core/src/multiarray/nditer_api.c +++ b/numpy/core/src/multiarray/nditer_api.c @@ -106,12 +106,6 @@ NpyIter_RemoveAxis(NpyIter *iter, int axis) return NPY_FAIL; } - if (NAD_SHAPE(axisdata_del) == 0) { - PyErr_SetString(PyExc_ValueError, - "cannot remove a zero-sized axis from an iterator"); - return NPY_FAIL; - } - /* Adjust the permutation */ for (idim = 0; idim < ndim-1; ++idim) { npy_int8 p = (idim < xdim) ? perm[idim] : perm[idim+1]; diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index caa36bd2d..52c2a6454 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -3269,14 +3269,6 @@ PyUFunc_Accumulate(PyUFuncObject *ufunc, PyArrayObject *arr, PyArrayObject *out, op[0] = NpyIter_GetOperandArray(iter)[0]; op[1] = NpyIter_GetOperandArray(iter)[1]; - if (PyArray_SIZE(op[0]) == 0) { - if (out == NULL) { - out = op[0]; - Py_INCREF(out); - } - goto finish; - } - if (NpyIter_RemoveAxis(iter, axis) != NPY_SUCCEED) { goto fail; } @@ -3623,35 +3615,6 @@ PyUFunc_Reduceat(PyUFuncObject *ufunc, PyArrayObject *arr, PyArrayObject *ind, need_outer_iterator = 1; } - /* Special case when the index array's size is zero */ - if (ind_size == 0) { - if (out == NULL) { - npy_intp out_shape[NPY_MAXDIMS]; - memcpy(out_shape, PyArray_SHAPE(arr), - PyArray_NDIM(arr) * NPY_SIZEOF_INTP); - out_shape[axis] = 0; - Py_INCREF(op_dtypes[0]); - op[0] = out = (PyArrayObject *)PyArray_NewFromDescr( - &PyArray_Type, op_dtypes[0], - PyArray_NDIM(arr), out_shape, NULL, NULL, - 0, NULL); - if (out == NULL) { - goto fail; - } - } - else { - /* Allow any zero-sized output array in this case */ - if (PyArray_SIZE(out) != 0) { - PyErr_SetString(PyExc_ValueError, - "output operand shape for reduceat is " - "incompatible with index array of shape (0,)"); - goto fail; - } - } - - goto finish; - } - if (need_outer_iterator) { npy_uint32 flags = NPY_ITER_ZEROSIZE_OK| NPY_ITER_REFS_OK| |