You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the output type is wider than the input type, a TypeError is raised. (Expected no error)
Conversely, when the output type is narrower than the input type, no TypeError is raised. (Expected error)
Thanks for the report! Seems like the check is the wrong way around. Maybe we can just get away with swapping it or maybe we should give a DeprecationWarning where it currently force-casts. Either should be straight forward to implement.
(I honestly would not be surprised if these type of issues exist for other less-used functions. EDIT: IIRC, it may still exist for take which is somewhat similar.)
Also within the same file, the closest resembling function to PyArray_TakeFrom seems to be PyArray_Choose but the latter doesn't seem to have the same issue.
Within PyArray_FromArray, there is a casting check to see if "out" can be casted to "input_dtype", which doesn't seem to be right: we want to check the reverse.
Yeah, in that case, there was a start on this a very long time ago, see gh-16319. Probably just needs a champion to push it a bit (although I don't know if there was any complexity, I suspect the safe way to just deprecate what succeeds currently rather than remove it immediately).
Describe the issue:
When the output type is wider than the input type, a TypeError is raised. (Expected no error)
Conversely, when the output type is narrower than the input type, no TypeError is raised. (Expected error)
Reproduce the code example:
Error message:
NumPy/Python version information:
1.22.4 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]
The text was updated successfully, but these errors were encountered: