Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BUG: Fix user dtype can-cast with python scalar during promotion #27543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

charris
Copy link
Member

@charris charris commented Oct 11, 2024

Backport of #27534.

The can-cast code for "Python scalars" was old and did not correctly take into account possible user-dtypes with respect to NEP 50 weak promotion.

To do this, we already had the necessary helper functions that go via promotion (although it took me some brooding to remember ;)).

So the fix is rather simple. Actually adding CI/test for the fix is unfortunately hard as it requires such a user DType.

The can-cast code for "Python scalars" was old and did not correctly
take into account possible user-dtypes with respect to NEP 50 weak
promotion.

To do this, we already had the necessary helper functions that go
via promotion (although it took me some brooding to remember ;)).

So the fix is rather simple.  Actually adding CI/test for the fix
is unfortunately hard as it requires such a user DType.
@charris charris added 00 - Bug 08 - Backport Used to tag backport PRs labels Oct 11, 2024
@charris charris added this to the 2.1.3 release milestone Oct 11, 2024
@charris charris merged commit 131c3b5 into numpy:maintenance/2.1.x Oct 11, 2024
65 checks passed
@charris charris deleted the backport-27534 branch October 11, 2024 16:52
jakevdp added a commit to jakevdp/ml_dtypes that referenced this pull request Oct 28, 2024
NumPy changed weak promotion semantics in numpy/numpy#27543,
and this caused some of our tests to fail for types that cannot represent zero.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug 08 - Backport Used to tag backport PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.