summaryrefslogtreecommitdiffstats
path: root/Lib/_pydecimal.py
diff options
context:
space:
mode:
authorElisha Hollander <just4now666666@gmail.com>2021-07-15 10:48:46 (GMT)
committerGitHub <noreply@github.com>2021-07-15 10:48:46 (GMT)
commit3527569f1cd0df697242b68a8a837f08904872fe (patch)
tree2418ac307466866f15a96c261406733472d12d44 /Lib/_pydecimal.py
parent28544609cb2a79d8d7ea5a54714d723669ef2adb (diff)
downloadcpython-3527569f1cd0df697242b68a8a837f08904872fe.zip
cpython-3527569f1cd0df697242b68a8a837f08904872fe.tar.gz
cpython-3527569f1cd0df697242b68a8a837f08904872fe.tar.bz2
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
Diffstat (limited to 'Lib/_pydecimal.py')
-rw-r--r--Lib/_pydecimal.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py
index 3d6cece..f6d9ddf 100644
--- a/Lib/_pydecimal.py
+++ b/Lib/_pydecimal.py
@@ -2230,7 +2230,7 @@ class Decimal(object):
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 @@ class Decimal(object):
# 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)