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
In #27715 we fixed a bug in nditer internals that affected fancy indexing for StringDType arrays. Ultimately this is caused by NumPy using PyArray_EquivTypes to check the cast between the DTypes is NPY_NO_CASTING. That is not a sufficient check in all cases, particularly for user DTypes like StringDType that store some array data on dtype instances. Instead, the correct thing to check is if the cast between the DTypes is NPY_NO_CASTINGand the view_offset is 0.
We should audit all internal uses of PyArray_EquivTypes and see if it could be problematic for StringDType arrays. If the check is used to see whether or not a cast between the arrays is needed, it should probably be updated to use PyArray_SafeCast. We should also investigate whether we should update PyArray_EquivTypes itself to do this check (or to call PyArray_SafeCast) and instead replace any places where we want exactly just the check for NPY_NO_CASTING with a new function that replaces EquivTypes.
See also #26317 and #26147 which fixed similar issues.
The text was updated successfully, but these errors were encountered:
In #27715 we fixed a bug in nditer internals that affected fancy indexing for StringDType arrays. Ultimately this is caused by NumPy using
PyArray_EquivTypes
to check the cast between the DTypes isNPY_NO_CASTING
. That is not a sufficient check in all cases, particularly for user DTypes like StringDType that store some array data on dtype instances. Instead, the correct thing to check is if the cast between the DTypes isNPY_NO_CASTING
and theview_offset
is 0.We should audit all internal uses of
PyArray_EquivTypes
and see if it could be problematic for StringDType arrays. If the check is used to see whether or not a cast between the arrays is needed, it should probably be updated to usePyArray_SafeCast
. We should also investigate whether we should updatePyArray_EquivTypes
itself to do this check (or to callPyArray_SafeCast
) and instead replace any places where we want exactly just the check forNPY_NO_CASTING
with a new function that replacesEquivTypes
.See also #26317 and #26147 which fixed similar issues.
The text was updated successfully, but these errors were encountered: