Skip to content

Commit 3527569

Browse files
authored
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
1 parent 2854460 commit 3527569

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/_pydecimal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,7 +2230,7 @@ def _power_exact(self, other, p):
22302230
if xe != 0 and len(str(abs(yc*xe))) <= -ye:
22312231
return None
22322232
xc_bits = _nbits(xc)
2233-
if xc != 1 and len(str(abs(yc)*xc_bits)) <= -ye:
2233+
if len(str(abs(yc)*xc_bits)) <= -ye:
22342234
return None
22352235
m, n = yc, 10**(-ye)
22362236
while m % 2 == n % 2 == 0:
@@ -2243,7 +2243,7 @@ def _power_exact(self, other, p):
22432243
# compute nth root of xc*10**xe
22442244
if n > 1:
22452245
# if 1 < xc < 2**n then xc isn't an nth power
2246-
if xc != 1 and xc_bits <= n:
2246+
if xc_bits <= n:
22472247
return None
22482248

22492249
xe, rem = divmod(xe, n)

0 commit comments

Comments
 (0)