From: Mark Dickinson Date: Thu, 8 Jul 2010 19:09:16 +0000 (+0000) Subject: Fix misplaced exactness check that was causing unnecessary work in Decimal.__pow__. X-Git-Tag: v3.2a1~270 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e42f1bb3548f322bc0fd4a5db4cff26be901a034;p=thirdparty%2FPython%2Fcpython.git Fix misplaced exactness check that was causing unnecessary work in Decimal.__pow__. --- diff --git a/Lib/decimal.py b/Lib/decimal.py index 71408a8e9edf..5cb5ea9ba0da 100644 --- a/Lib/decimal.py +++ b/Lib/decimal.py @@ -2327,9 +2327,10 @@ class Decimal(object): # try for an exact result with precision +1 if ans is None: ans = self._power_exact(other, context.prec + 1) - if ans is not None and result_sign == 1: - ans = _dec_from_triple(1, ans._int, ans._exp) - exact = True + if ans is not None: + if result_sign == 1: + ans = _dec_from_triple(1, ans._int, ans._exp) + exact = True # usual case: inexact result, x**y computed directly as exp(y*log(x)) if ans is None: