Skip to content

BUG? anything is allowed to cast to structured dtypes? #11114

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

Closed
mhvk opened this issue May 18, 2018 · 0 comments · Fixed by #13648
Closed

BUG? anything is allowed to cast to structured dtypes? #11114

mhvk opened this issue May 18, 2018 · 0 comments · Fixed by #13648

Comments

@mhvk
Copy link
Contributor

mhvk commented May 18, 2018

I found while writing a ufunc that takes structured dtypes for its inputs that casting of essentially everything is allowed to a structured dtype, which is surprising. This is reflected in can_cast:

np.can_cast('f8', 'u1')
# False
np.can_cast('f8', '2u1')
# True

I would have expected, at least for safe, that casting would only be allowed if the dtypes were the same (or, perhaps, that can_cast was applied recursively).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants