mirror of
https://github.com/python/cpython
synced 2024-09-06 04:03:28 +00:00
Remove unnecessary test for xc == 1
in _pydecimal (GH-27102)
- if `xc == 1` then the function returns on line 2140; - other assignments to `xc` are inside the `y.sign == 1` condition block which always returns early
This commit is contained in:
parent
28544609cb
commit
3527569f1c
|
@ -2230,7 +2230,7 @@ def _power_exact(self, other, p):
|
|||
if xe != 0 and len(str(abs(yc*xe))) <= -ye:
|
||||
return None
|
||||
xc_bits = _nbits(xc)
|
||||
if xc != 1 and len(str(abs(yc)*xc_bits)) <= -ye:
|
||||
if len(str(abs(yc)*xc_bits)) <= -ye:
|
||||
return None
|
||||
m, n = yc, 10**(-ye)
|
||||
while m % 2 == n % 2 == 0:
|
||||
|
@ -2243,7 +2243,7 @@ def _power_exact(self, other, p):
|
|||
# compute nth root of xc*10**xe
|
||||
if n > 1:
|
||||
# if 1 < xc < 2**n then xc isn't an nth power
|
||||
if xc != 1 and xc_bits <= n:
|
||||
if xc_bits <= n:
|
||||
return None
|
||||
|
||||
xe, rem = divmod(xe, n)
|
||||
|
|
Loading…
Reference in a new issue