summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2022-05-04 14:48:22 +0200
committerSebastian Berg <sebastian@sipsolutions.net>2022-06-13 09:36:57 -0700
commit9c74efa571dc0ac5fd18799105fd678cd8042282 (patch)
tree71bbeab99803d916e85d7431417f571e366ff9db /numpy
parent219697afb8bc0dfe3b0332a9a6bf3efd8a558e45 (diff)
downloadnumpy-9c74efa571dc0ac5fd18799105fd678cd8042282.tar.gz
BUG: Fix needs_api for avanced assignments without subspace and remove unnecessary delay
The delay is not necessary, because the iterator does not cast in any case, so we do not actually care about the possibility of errors being raised.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/lowlevel_strided_loops.c.src6
-rw-r--r--numpy/core/src/multiarray/mapping.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
index 827f0b615..8e3afd3cc 100644
--- a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
+++ b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
@@ -1597,9 +1597,11 @@ mapiter_@name@(
if (mit->subspace_iter == NULL) {
/*
* Item by item copy situation, the operand is buffered
- * so use copyswap.
+ * so use copyswap. The iterator may not do any transfers, so may
+ * not have set `needs_api` yet, set it if necessary:
*/
- PyArray_CopySwapFunc *copyswap = PyArray_DESCR(array)->f->copyswap;
+ needs_api |= PyDataType_REFCHK(PyArray_DESCR(array));
+ PyArray_CopySwapFunc *copyswap = PyArray_DESCR(array)->f->copyswap;
/* We have only one iterator handling everything */
counter = NpyIter_GetInnerLoopSizePtr(mit->outer);
diff --git a/numpy/core/src/multiarray/mapping.c b/numpy/core/src/multiarray/mapping.c
index d378dc8e5..78a2335f2 100644
--- a/numpy/core/src/multiarray/mapping.c
+++ b/numpy/core/src/multiarray/mapping.c
@@ -1934,7 +1934,6 @@ array_assign_subscript(PyArrayObject *self, PyObject *ind, PyObject *op)
index_num == 1 && tmp_arr) {
/* The array being indexed has one dimension and it is a fancy index */
PyArrayObject *ind = (PyArrayObject*)indices[0].object;
-
/* Check if the type is equivalent */
if (PyArray_EquivTypes(PyArray_DESCR(self),
PyArray_DESCR(tmp_arr)) &&
@@ -3080,8 +3079,7 @@ PyArray_MapIterNew(npy_index_info *indices , int index_num, int index_type,
mit->extra_op_iter = NpyIter_AdvancedNew(1, &extra_op,
NPY_ITER_ZEROSIZE_OK |
NPY_ITER_REFS_OK |
- NPY_ITER_GROWINNER |
- NPY_ITER_DELAY_BUFALLOC,
+ NPY_ITER_GROWINNER,
NPY_CORDER,
NPY_NO_CASTING,
&extra_op_flags,