Revert r86517

This commit is contained in:
Raymond Hettinger 2010-11-21 04:08:28 +00:00
parent 2dad5cade4
commit d325c4b233
3 changed files with 2 additions and 5 deletions

View File

@ -943,7 +943,7 @@ class Decimal(object):
# in the documentation. (See library docs, 'Built-in Types'). # in the documentation. (See library docs, 'Built-in Types').
if self._is_special: if self._is_special:
if self.is_snan(): if self.is_snan():
raise ValueError('Cannot hash a signaling NaN value.') raise TypeError('Cannot hash a signaling NaN value.')
elif self.is_nan(): elif self.is_nan():
return _PyHASH_NAN return _PyHASH_NAN
else: else:

View File

@ -1346,7 +1346,7 @@ class DecimalUsabilityTest(unittest.TestCase):
#the same hash that to an int #the same hash that to an int
self.assertEqual(hashit(Decimal(23)), hashit(23)) self.assertEqual(hashit(Decimal(23)), hashit(23))
self.assertRaises(ValueError, hash, Decimal('sNaN')) self.assertRaises(TypeError, hash, Decimal('sNaN'))
self.assertTrue(hashit(Decimal('Inf'))) self.assertTrue(hashit(Decimal('Inf')))
self.assertTrue(hashit(Decimal('-Inf'))) self.assertTrue(hashit(Decimal('-Inf')))

View File

@ -172,9 +172,6 @@ Library
- Issue #10465: fix broken delegating of attributes by gzip._PaddedFile. - Issue #10465: fix broken delegating of attributes by gzip._PaddedFile.
- Issue #10356: hash(Decimal("sNaN")) now raises ValueError instead of
TypeError.
- Issue #10356: Decimal.__hash__(-1) should return -2. - Issue #10356: Decimal.__hash__(-1) should return -2.
- Issue #1553375: logging: Added stack_info kwarg to display stack information. - Issue #1553375: logging: Added stack_info kwarg to display stack information.