Skip to content

Commit

Permalink
MAINT: avoid can_cast(pyscalar, dtype) NumPy 2 refuses it (for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
seberg committed May 31, 2024
1 parent b17af57 commit 9e5d611
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/cudf/cudf/core/_internals/where.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ def _check_and_cast_columns_with_other(
)
return _normalize_categorical(source_col, other.astype(source_dtype))

if _is_non_decimal_numeric_dtype(source_dtype) and _can_cast(
other, source_dtype
if (
_is_non_decimal_numeric_dtype(source_dtype)
and not other_is_scalar # can-cast fails for Python scalars
and _can_cast(other, source_dtype)
):
common_dtype = source_dtype
elif (
Expand Down

0 comments on commit 9e5d611

Please sign in to comment.