Repository navigation
BUG: avoid mutation of shape attibutes (modeling, 2/2) - #19152
Merged
Merged
Conversation
Avoid setting .shape in test_models.py
Co-authored-by: Marten van Kerkwijk <[email protected]>
Contributor
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
mhvk
approved these changes
Jan 14, 2026
mhvk
left a comment
Contributor
There was a problem hiding this comment.
Looks all good to me, thanks!
| z = gauss2d(x, y) | ||
| w = np.ones(x.size) | ||
| w.shape = x.shape | ||
| w = np.ones(x.shape) |
Member
|
Thanks, all! |
meeseeksmachine
pushed a commit
to meeseeksmachine/astropy
that referenced
this pull request
Jan 14, 2026
pllim
added a commit
that referenced
this pull request
Jan 14, 2026
…152-on-v7.2.x Backport PR #19152 on branch v7.2.x (BUG: avoid mutation of shape attibutes (modeling, 2/2))
osasisorae
added a commit
to osasisorae/astropy
that referenced
this pull request
Jan 18, 2026
Replace .shape = assignments with .resize(new_shape, refcheck=False) to maintain compatibility with NumPy 2.5+ while preserving all existing functionality. Changes: - coordinates/solar_system.py: Fix body_posvel_bary shape assignment - coordinates/representation/base.py: Fix component and differential shape assignments - time/core.py: Fix val shape assignments with error recovery - io/ascii/ecsv.py: Fix column shape assignments (2 occurrences) - io/fits/util.py: Fix array reshape in NumPy < 2.5 branch - io/fits/fitsrec.py: Fix field shape assignment - uncertainty/core.py: Fix structured array shape assignment - Test files: Update compressed FITS and image tests All fixes use refcheck=False parameter for Astropy's array views and follow patterns from merged PRs astropy#19127-astropy#19152.
7 tasks done
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.
Description
This is a continuation of #19129, originated in #19150. I'm porting it to main so it can get its own review and backport cycle.
Commits are from @pllim and @mhvk, but I'm happy to endorse them.