summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2022-06-01 19:09:35 -0700
committerSebastian Berg <sebastian@sipsolutions.net>2022-06-13 09:36:57 -0700
commit63fa74a6150b7cea0497e232a60bee9d10a87e8d (patch)
tree8beebbc688313e7025d89d80cdbcc646d75f657c /numpy/core/src
parentb463a7fcee642eb75ec7fd5faa33f3fabbcfb258 (diff)
downloadnumpy-63fa74a6150b7cea0497e232a60bee9d10a87e8d.tar.gz
BUG: Avoid `NpyIter_EnableExternalLoop` as it resets the buffer
Resetting the buffer will copy it, which may cause casting errors. And we want to prefer/catch those later ideally.
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/multiarray/mapping.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/core/src/multiarray/mapping.c b/numpy/core/src/multiarray/mapping.c
index 78a2335f2..98c2d7eda 100644
--- a/numpy/core/src/multiarray/mapping.c
+++ b/numpy/core/src/multiarray/mapping.c
@@ -2991,6 +2991,11 @@ PyArray_MapIterNew(npy_index_info *indices , int index_num, int index_type,
/* If external array is iterated, and no subspace is needed */
nops = mit->numiter;
+
+ if (!uses_subspace) {
+ outer_flags |= NPY_ITER_EXTERNAL_LOOP;
+ }
+
if (extra_op_flags && !uses_subspace) {
/*
* NOTE: This small limitation should practically not matter.
@@ -3038,9 +3043,6 @@ PyArray_MapIterNew(npy_index_info *indices , int index_num, int index_type,
if (mit->outer == NULL) {
goto fail;
}
- if (!uses_subspace) {
- NpyIter_EnableExternalLoop(mit->outer);
- }
mit->outer_next = NpyIter_GetIterNext(mit->outer, NULL);
if (mit->outer_next == NULL) {