Fix scalar Quantity pattern matching#964
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #964 +/- ##
=======================================
Coverage 75.60% 75.60%
=======================================
Files 70 70
Lines 8981 8983 +2
=======================================
+ Hits 6790 6792 +2
Misses 2191 2191 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
teutoburg
force-pushed
the
teutoburg-patch-1
branch
from
July 24, 2026 13:36
86920ae to
b3a0aca
Compare
teutoburg
marked this pull request as ready for review
July 24, 2026 16:48
teutoburg
enabled auto-merge
July 24, 2026 17:55
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.
This started occurring in the updated dependency tests today (which is good in a way, that's exactly why we run those tests!!) after skycalc_ipy 0.7.1 started allowing NumPy > 2.4. I traced it down to the structural pattern matching, which was changed in NumPy 2.5, and is now causing a scalar
u.Quantityto fail matching for a 2-tuple. This used to work, because the structured pattern matching treated theu.Quantityas a single object, so didn't match the 2-tuple and went instead to the singlevaluecase. Flipping thecasestatements around won't work, because then an actual 2-tuple would match the single object already (actually Python is smart enough to raise aSyntaxErrorin tht case). The fix now checks for the singleu.Quantitybefore, which seems to work.I have some hope that Astropy 8.x will fix that again, we'll see...