summaryrefslogtreecommitdiffstats
path: root/Lib/decimal.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-08-28 13:35:02 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-08-28 13:35:02 (GMT)
commit7f265b7fac81de000fe57a7e6ab6ad5a141c1342 (patch)
treea29866c197970f35554c8e4ffda5415ad49c53bc /Lib/decimal.py
parentfa680dcd2ff4d6d0a734a8bf8b91807b5e0c65ac (diff)
downloadcpython-7f265b7fac81de000fe57a7e6ab6ad5a141c1342.zip
cpython-7f265b7fac81de000fe57a7e6ab6ad5a141c1342.tar.gz
cpython-7f265b7fac81de000fe57a7e6ab6ad5a141c1342.tar.bz2
Merged revisions 74564 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74564 | mark.dickinson | 2009-08-28 14:25:02 +0100 (Fri, 28 Aug 2009) | 3 lines 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.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py
index ffc0fe8..7c90f0a 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -2693,12 +2693,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: