Skip to content

Commit

Permalink
make compatible with non-production pytato
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener committed Sep 13, 2024
1 parent 71eec4e commit f34cb4e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pytato/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,11 @@ def cast_to_result_type(

expr = TypeCast(result_dtype, expr)
elif isinstance(expr, SCALAR_CLASSES):
import operator
# See https://github.com/inducer/pytato/issues/542
# on why pow() + integers is not typecast to float or complex.
if not (op == prim.Power and np.issubdtype(type(expr), np.integer)
if not ((op == prim.Power or op == operator.pow)
and np.issubdtype(type(expr), np.integer)
and not np.issubdtype(result_dtype, np.integer)):
expr = result_dtype.type(expr)

Expand Down

0 comments on commit f34cb4e

Please sign in to comment.