# HG changeset patch # User Paul Boddie # Date 1548980361 -3600 # Node ID c16c7d729f13e2aee3eeaed8e1165f2f866e9d82 # Parent 2eae728285eecb801b4f82013a8fe4daa16067be Added direct conversion to float for int exponents used with floats. diff -r 2eae728285ee -r c16c7d729f13 lib/operator/binary.py --- a/lib/operator/binary.py Fri Feb 01 00:52:20 2019 +0100 +++ b/lib/operator/binary.py Fri Feb 01 01:19:21 2019 +0100 @@ -25,7 +25,8 @@ int_lshift, int_rshift, \ int_and, int_not, int_or, int_xor, \ is_int, \ - float_add, float_div, float_mul, float_pow, float_sub + float_add, float_div, float_mul, float_pow, float_sub, \ + int_float # These functions defer method lookup by wrapping the attribute access in # lambda functions. Thus, the appropriate methods are defined locally, but no @@ -89,8 +90,11 @@ def pow(a, b): if is_int(a) and is_int(b): return int_pow(a, b) - elif a.__class__ is float and b.__class__ is float: - return float_pow(a, b) + elif a.__class__ is float: + if is_int(b): + b = int_float(b) + if b.__class__ is float: + return float_pow(a, b) return binary_op(a, b, lambda a: a.__pow__, lambda b: b.__rpow__) def rshift(a, b):