diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-08-28 13:25:02 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-08-28 13:25:02 (GMT) |
commit | 7a7739d75ed505033445248a126830bedb17101b (patch) | |
tree | c86f33b1ba2046d8f47e58554f8db27eef553abd /Lib/decimal.py | |
parent | 429677ec38586d61cee479da9addf31ed1b2b1c0 (diff) | |
download | cpython-7a7739d75ed505033445248a126830bedb17101b.zip cpython-7a7739d75ed505033445248a126830bedb17101b.tar.gz cpython-7a7739d75ed505033445248a126830bedb17101b.tar.bz2 |
Issue #6794: Fix handling of NaNs in Decimal.compare_total and
Decimal.compare_total_mag.
Diffstat (limited to 'Lib/decimal.py')
-rw-r--r-- | Lib/decimal.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py index f36e846..e786453 100644 --- a/Lib/decimal.py +++ b/Lib/decimal.py @@ -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: |