Skip to content

Navigation Menu

Sign in
Appearance settings

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 #27534

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 10, 2024

Conversation

seberg
Copy link
Member

@seberg seberg commented Oct 9, 2024

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.

Closes gh-27389

@jakevdp while annoying, I am not certain that it is worth adding yet another (or multiple) user-dtypes to NumPy just to test this branch. Do you think ml_types covers it quite well for the time being?

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 the 09 - Backport-Candidate PRs tagged should be backported label Oct 9, 2024
@charris charris merged commit a5cb327 into numpy:main Oct 10, 2024
68 checks passed
@charris
Copy link
Member

charris commented Oct 10, 2024

Let's give it a shot, we learn more when it is used. Thanks Sebastian.

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: NumPy 2.0 type promotion semantics are inconsistent for builtin vs. custom dtypes
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.