BUG: Fix resize when it contains references#29970
Merged
ngoldbaum merged 2 commits intonumpy:mainfrom Oct 28, 2025
Merged
Conversation
mhvk
reviewed
Oct 15, 2025
Contributor
mhvk
left a comment
There was a problem hiding this comment.
Looks good, just one missing assert.
numpy/_core/tests/test_multiarray.py
Outdated
| test_obj = object() | ||
| expected = sys.getrefcount(test_obj) | ||
| a = np.array([test_obj, test_obj, test_obj], dtype=dtype) | ||
| a.size == 3 |
Contributor
For object arrays, I think it pays to just be correct -- and everything is slow anyway, |
seberg
commented
Oct 15, 2025
ngoldbaum
reviewed
Oct 15, 2025
| assert a.size == 2 | ||
| del a | ||
| # if all is well, then we reclaimed all references | ||
| assert sys.getrefcount(test_obj) == expected |
139c755 to
b847956
Compare
Member
|
Thanks @seberg thanks for the nudge. |
charris
pushed a commit
to charris/numpy
that referenced
this pull request
Oct 28, 2025
charris
added a commit
that referenced
this pull request
Oct 29, 2025
BUG: Fix resize when it contains references (#29970)
cakedev0
pushed a commit
to cakedev0/numpy
that referenced
this pull request
Dec 5, 2025
IndifferentArea
pushed a commit
to IndifferentArea/numpy
that referenced
this pull request
Dec 7, 2025
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.
Small fix for resize with objects, which was always broken.
@mhvk one little thing is that we of course don't need to do this in all of the internal places in theory.
Closes gh-29887.