From f34cb4ef0bfef16ff699b007f977a26980a4ff5d Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Fri, 13 Sep 2024 16:20:17 -0500 Subject: [PATCH] make compatible with non-production pytato --- pytato/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pytato/utils.py b/pytato/utils.py index 9bd80c3d..aa191f23 100644 --- a/pytato/utils.py +++ b/pytato/utils.py @@ -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)