# HG changeset patch # User Paul Boddie # Date 1548981023 -3600 # Node ID b76b924d350a7fd3f3aed19ba9a48aac3caf7bc2 # Parent 43f7a46d1e0d70200a5d5768c7fa6d7ad0054df8# Parent c16c7d729f13e2aee3eeaed8e1165f2f866e9d82 Merged changes from trailing-data. diff -r 43f7a46d1e0d -r b76b924d350a lib/operator/binary.py --- a/lib/operator/binary.py Fri Feb 01 00:58:04 2019 +0100 +++ b/lib/operator/binary.py Fri Feb 01 01:30:23 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):