Skip to content

BUG: restore ndarray.conjugate() for legacy user-defined dtypes - #31936

Merged
seberg merged 3 commits into
numpy:mainfrom
seberg:fix-conjugate-legacy-user-dtype
Jul 10, 2026
Merged

seberg merged 3 commits into
numpy:mainfrom
seberg:fix-conjugate-legacy-user-dtype

Conversation

@seberg

@seberg seberg commented Jul 9, 2026 •

Copy link
Copy Markdown
Member

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

moble and others added 2 commits June 25, 2026 12:45
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
@seberg seberg added 09 - Backport-Candidate PRs tagged should be backported 00 - Bug labels Jul 9, 2026

@ngoldbaum ngoldbaum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM I just think you accidentally a word in the comment.

@seberg
seberg merged commit 680f065 into numpy:main Jul 10, 2026
87 checks passed
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Jul 10, 2026
charris pushed a commit that referenced this pull request Jul 10, 2026
charris added a commit that referenced this pull request Jul 10, 2026
BUG: restore ndarray.conjugate() for legacy user-defined dtypes (#31936)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: ndarray.conjugate() regression for legacy user-defined dtypes in 2.5.0

4 participants