BUG: fix reference counting bug in __array_interface__ implementation#27249
Merged
seberg merged 2 commits intonumpy:mainfrom Aug 21, 2024
Merged
BUG: fix reference counting bug in __array_interface__ implementation#27249seberg merged 2 commits intonumpy:mainfrom
seberg merged 2 commits intonumpy:mainfrom
Conversation
mhvk
approved these changes
Aug 20, 2024
Contributor
mhvk
left a comment
There was a problem hiding this comment.
Good catch. Suggestion for a different solution, but not very important.
| } | ||
| } | ||
| } | ||
| Py_DECREF(descr); |
Contributor
There was a problem hiding this comment.
Why not just move the Py_DECREF(descr) up inside the branch where descr is defined? Outside of that branch, it is guaranteed to be NULL (similarly, the definition of new_dtype can be much closer to its use...).
Contributor
There was a problem hiding this comment.
Now looked at the original issue, where I see @seberg also noted it should be put up: reason is that if GetStringRef returns 0, then the key was not present so descr cannot have been set.
Member
|
Thanks Nathan! |
seberg
added a commit
to seberg/numpy
that referenced
this pull request
Aug 21, 2024
This adds a simple regression test for the missing descr for numpygh-27249.
charris
pushed a commit
to charris/numpy
that referenced
this pull request
Aug 22, 2024
…numpy#27249) * BUG: fix reference counting bug in __array_interface__ implementation * MAINT: only decref if the reference is valid
charris
pushed a commit
to charris/numpy
that referenced
this pull request
Aug 22, 2024
This adds a simple regression test for the missing descr for numpygh-27249.
charris
pushed a commit
to charris/numpy
that referenced
this pull request
Aug 22, 2024
This adds a simple regression test for the missing descr for numpygh-27249.
ArvidJB
pushed a commit
to ArvidJB/numpy
that referenced
this pull request
Nov 1, 2024
…numpy#27249) * BUG: fix reference counting bug in __array_interface__ implementation * MAINT: only decref if the reference is valid
ArvidJB
pushed a commit
to ArvidJB/numpy
that referenced
this pull request
Nov 1, 2024
This adds a simple regression test for the missing descr for numpygh-27249.
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@seberg ran into this testing
cunumeric: https://github.com/numpy/numpy/pull/26282/files#r1722321473.Unfortunately there are no existing tests for this code path so we missed this breakage.
I tried writing an example that triggered this code path for a while this afternoon but was unable to.