Merged revisions 74566 via svnmerge from
svn+ssh://pythondev@www.python.org/python/branches/py3k

................
  r74566 | mark.dickinson | 2009-08-28 14:39:53 +0100 (Fri, 28 Aug 2009) | 10 lines

  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.
  ........
................
diff --git a/Lib/decimal.py b/Lib/decimal.py
index 042dd8b..8d82cb9 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -2819,12 +2819,15 @@
         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: