Commit c2024f7
BUG: fancy indexing copy (numpy#26558)
* BUG: fancy indexing copy
* Fixes numpygh-26542
* For these very simple advanced indexing cases,
if the `result` and `self` arrays share the same
data pointers, use a copy of `result` to assign
values to `self`, otherwise the outcome of the fancy
indexing suffers from mutation of `result` before
the assignments are complete.
* MAINT, BUG: PR 26558 revisions
* Avoid leaking the old `tmp_arr`, based on reviewer feedback.
* Add a test for a similar 2D case that fails, then hoist
`solve_may_share_memory()` check farther up in the control
flow such that the test passes.
* Add a reviewer-requested test for index overlap.
* BUG: PR 26558 revisions
* The usage of `solve_may_share_memory` in the above
PR wasn't quite right since it ignored the case of failing
to solve the overlap problem. This has been revised according
to reviewer feedback.
Co-authored-by: Sebastian Berg <sebastianb@nvidia.com>
---------
Co-authored-by: Sebastian Berg <sebastianb@nvidia.com>1 parent c13fb3a commit c2024f7
2 files changed
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1960 | 1960 | | |
1961 | 1961 | | |
1962 | 1962 | | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
1963 | 1967 | | |
1964 | 1968 | | |
1965 | 1969 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
136 | 158 | | |
137 | 159 | | |
138 | 160 | | |
| |||
0 commit comments