Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BUG: fancy indexing copy #26868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2024
Merged

Conversation

charris
Copy link
Member

@charris charris commented Jul 5, 2024

Backport of #26558.

  • BUG: fancy indexing copy

  • Fixes Fancy indexing fails on a[idx] = a #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.


* 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>
@charris charris added this to the 2.0.1 release milestone Jul 5, 2024
@charris charris merged commit c8c1e4e into numpy:maintenance/2.0.x Jul 5, 2024
59 of 60 checks passed
@charris charris deleted the backport-26558 branch July 5, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.