riptable icon indicating copy to clipboard operation
riptable copied to clipboard

``rt.putmask`` does nothing when dtypes are incompatible

Open jack-pappas opened this issue 4 years ago • 0 comments

When called with two arrays which have incompatible dtypes (according to numpy's "safe" casting rule), np.putmask raises a TypeError with a message indicating the types are incompatible.

In riptable 1.0.54 (and earlier versions), rt.putmask ignores the mismatch and silently does nothing -- it neither raises an exception nor modifies the target array. rt.putmask should be checking for compatibility of the array dtypes using e.g. np.can_cast(source.dtype, target.dtype, casting='safe') and raising a TypeError when the check fails.

jack-pappas avatar Jun 29 '21 19:06 jack-pappas