Index: Lib/decimal.py =================================================================== --- Lib/decimal.py (revision 67649) +++ Lib/decimal.py (working copy) @@ -761,9 +761,16 @@ if self > other. This routine is for internal use only.""" if self._is_special or other._is_special: - return cmp(self._isinfinity(), other._isinfinity()) + self_inf = self._isinfinity() + other_inf = other._isinfinity() + if self_inf == other_inf: + return 0 + elif self_inf < other_inf: + return -1 + else: + return 1 - # check for zeros; note that cmp(0, -0) should return 0 + # check for zeros; note that _cmp(0, -0) should return 0 if not self: if not other: return 0 @@ -783,7 +790,12 @@ if self_adjusted == other_adjusted: self_padded = self._int + '0'*(self._exp - other._exp) other_padded = other._int + '0'*(other._exp - self._exp) - return cmp(self_padded, other_padded) * (-1)**self._sign + if self_padded == other_padded: + return 0 + elif self_padded < other_padded: + return -((-1)**self._sign) + else: + return (-1)**self._sign elif self_adjusted > other_adjusted: return (-1)**self._sign else: # self_adjusted < other_adjusted Index: Lib/test/test_decimal.py =================================================================== --- Lib/test/test_decimal.py (revision 67649) +++ Lib/test/test_decimal.py (working copy) @@ -1013,17 +1013,11 @@ self.failUnless(da != dc) self.failUnless(da <= db) self.failUnless(da >= db) - self.assertEqual(cmp(dc,da), 1) - self.assertEqual(cmp(da,dc), -1) - self.assertEqual(cmp(da,db), 0) #a Decimal and an int self.failUnless(dc > 23) self.failUnless(23 < dc) self.assertEqual(dc, 45) - self.assertEqual(cmp(dc,23), 1) - self.assertEqual(cmp(23,dc), -1) - self.assertEqual(cmp(dc,45), 0) #a Decimal and uncomparable self.assertNotEqual(da, 'ugly')