-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
API: Do not consider subclasses for NEP 50 weak promotion #26905
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
Conversation
This disables remaining checks for subclasses of floats. We only apply the weak rules to literals, and thus just ignore subclasses.
1d9b38c
to
f3b669d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is because isinstance(np.float64(1.), float)
is True, right? I guess in principle another float
subclass might exist for which weak promotion might make sense, and an alternative might be to explicitly exclude np.generic
subclasses. But since that only makes things slower, probably best to do what you have here! (We can always revisit if the need arises.)
I think the build failures on the OpenBLAS CI are real. Might just be a matter of giving |
Fun that it suddenly shows up, it isn't new. Anyway, harmless but not wrong, easy enough to avoid. |
This is a subtlety that we might otherwise run into in Python, I guess. So a bit :).
Either way, in some future a custom DType could probably create custom weak scalars if that comes up. But that would have complicated things (and this was difficult enough). Once legacy promotion paths are gone, I suspect one could attack it. Although, I honestly doubt it is worthwhile to do it even if we can. |
Thanks, that all makes sense! |
Thanks @seberg |
This disables remaining checks for subclasses of floats. We only
apply the weak rules to literals, and thus just ignore subclasses.
Closes gh-26852
Draft because it is based on gh-26904