FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

BUG: Fix subarray to object cast ownership details by charris · Pull Request #22036 · numpy/numpy · GitHub

/ numpy Public

BUG: Fix subarray to object cast ownership details - #22036

Merged
charris merged 2 commits into
numpy:maintenance/1.23.xfrom
charris:backport-21925
Jul 24, 2022
Merged

charris merged 2 commits into
numpy:maintenance/1.23.xfrom
charris:backport-21925

Conversation

charris commented Jul 24, 2022

Copy link
Copy Markdown
Member

Backport of #21925.

This would be the minimal fix for gh-21911 (and an older issue somewhere). However, it would also set a precedence that subarray to object casts will create copies.
That is likely fine, since those casts usually crashed for a while and in many places a copy is OK. It was also always broken from an ownership perspective.
However, for code that used this and assigned to the result, things would obviously change.

There are three options:

  1. Less-minimal fix, because we want view behavior here (and fix it).
  2. Keep it as it is (it was so unreliable that failures are hopefully minimal, and why would one cast to object to then assign?).
  3. We could tag on a warning, I don't think the warning "flag" is used right now. I.e. print out a UserWarning that this is a copy, but may have been a view whenever the array may be written to. (This may not be quite reliable for buffer users like cython, but not sure.)

charris added 00 - Bug 08 - Backport Used to tag backport PRs labels Jul 24, 2022
charris added this to the 1.23.2 release milestone Jul 24, 2022
charris merged commit 5e80d8e into numpy:maintenance/1.23.x Jul 24, 2022
charris deleted the backport-21925 branch July 24, 2022 15:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

00 - Bug 08 - Backport Used to tag backport PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL