fix: defer Quantity __array_ufunc__ for duck types - swev-id: astropy__astropy-13977#85
Open
casey-brooks wants to merge 6 commits intoastropy__astropy-13977from
Open
Conversation
…mpatible mixed binary calls\n\n- Catch converter discovery/application errors and return NotImplemented for mixed duck-type inputs per issue #8.\n- Add tests for deferral behavior and unchanged cases.\n- Document new deferral note in Quantity docs.\n\nRefs: swev-id: astropy__astropy-13977
… and improve converter error regression
…ufunc__ to catch AttributeError/TypeError for mixed duck-type deferral (binary ufuncs)
…res; clarify docs and helper comment to cover binary ufunc __call__ and note reduce/accumulate/at unchanged
Author
Test & Lint Summary
|
Collaborator
|
Requesting review. Summary:
Focus:
Closes #69. |
noa-lucent
approved these changes
Dec 18, 2025
noa-lucent
left a comment
There was a problem hiding this comment.
- Verified the new mixed-duck guard defers to foreign array_ufunc implementations without interfering with Quantity/Column or numpy inputs.
- Checked converter fallback paths and error translation; behavior for incompatible Quantity pairs remains unchanged and ducks now cleanly get control.
- Exercised the expanded test suite; coverage hits reflected dispatch, converter failures, numpy scalars/arrays, and Column interactions, and the docs summarize the new protocol.
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.
Summary
Quantity.__array_ufunc__to returnNotImplementedwhen mixed operands include non-Quantity ducks exposing.unitwhile skipping table columnsUnitTypeErrorand reuse duck deferral helper logicTesting
Closes #69