Repository navigation
BUG: restore ndarray.conjugate() for legacy user-defined dtypes - #31936
Merged
Merged
Conversation
numpygh-31264 rewrote PyArray_Conjugate to dispatch to the conjugate ufunc only when the DType defines an `imag_meth` slot, dropping the explicit `PyArray_ISUSERDEF` route. Legacy user dtypes have no `imag_meth` and are not flagged numeric, so `arr.conjugate()` began raising "cannot conjugate non-numeric dtype" in 2.5.0, even when a conjugate ufunc loop is registered (e.g. numpy-quaternion). Restore the legacy user-dtype route so these dtypes dispatch to the ufunc as before, while leaving the new-style view/numeric behavior intact. Closes numpy#31754
ngoldbaum
approved these changes
Jul 9, 2026
ngoldbaum
left a comment
Member
There was a problem hiding this comment.
LGTM I just think you accidentally a word in the comment.
Co-authored-by: Nathan Goldbaum <[email protected]>
charris
pushed a commit
that referenced
this pull request
Jul 10, 2026
Co-authored-by: Mike Boyle <[email protected]> Co-authored-by: Nathan Goldbaum <[email protected]>
charris
added a commit
that referenced
this pull request
Jul 10, 2026
BUG: restore ndarray.conjugate() for legacy user-defined dtypes (#31936)
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.
Kept the old PR. The problem is that while legacy user dtypes can implement things and even make themselves "Numeric" in theory, they aren't in practice and they should probably just keep trying the ufunc...
However, unlike the old PR. However, at least open a path forward if the numeric flag is set (possible via new "backport" API) and maybe we can even provide a nicer way to set it (not that you can't just do it in theory...).
CC @moble
Closes gh-31754