From a7dd2cb2e9d24a77c8a448bce4ba09b4e91099e8 Mon Sep 17 00:00:00 2001 From: Ed Schofield Date: Wed, 21 Feb 2024 15:45:48 +1100 Subject: [PATCH] Fix pow() with negative newint (issue #568) --- src/future/types/newint.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/future/types/newint.py b/src/future/types/newint.py index 2c86ce18..ebc5715e 100644 --- a/src/future/types/newint.py +++ b/src/future/types/newint.py @@ -223,9 +223,11 @@ def __pow__(self, other): def __rpow__(self, other): value = super(newint, self).__rpow__(other) - if value is NotImplemented: + if isint(value): + return newint(value) + elif value is NotImplemented: return other ** long(self) - return newint(value) + return value def __lshift__(self, other): if not isint(other):