mirror of
https://github.com/python/cpython.git
synced 2025-08-01 23:53:15 +00:00
Issue #6794: Fix handling of NaNs in Decimal.compare_total and
Decimal.compare_total_mag.
This commit is contained in:
parent
429677ec38
commit
7a7739d75e
3 changed files with 24 additions and 2 deletions
|
@ -2736,12 +2736,15 @@ class Decimal(object):
|
|||
other_nan = other._isnan()
|
||||
if self_nan or other_nan:
|
||||
if self_nan == other_nan:
|
||||
if self._int < other._int:
|
||||
# compare payloads as though they're integers
|
||||
self_key = len(self._int), self._int
|
||||
other_key = len(other._int), other._int
|
||||
if self_key < other_key:
|
||||
if sign:
|
||||
return _One
|
||||
else:
|
||||
return _NegativeOne
|
||||
if self._int > other._int:
|
||||
if self_key > other_key:
|
||||
if sign:
|
||||
return _NegativeOne
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue