From: Raymond Hettinger Date: Sun, 21 Nov 2010 04:08:28 +0000 (+0000) Subject: Revert r86517 X-Git-Tag: v3.2b1~266 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d325c4b233bdf36110c4c97e51b895972cbcf672;p=python Revert r86517 --- diff --git a/Lib/decimal.py b/Lib/decimal.py index b78c2c5774..5a9f840771 100644 --- a/Lib/decimal.py +++ b/Lib/decimal.py @@ -943,7 +943,7 @@ class Decimal(object): # in the documentation. (See library docs, 'Built-in Types'). if self._is_special: if self.is_snan(): - raise ValueError('Cannot hash a signaling NaN value.') + raise TypeError('Cannot hash a signaling NaN value.') elif self.is_nan(): return _PyHASH_NAN else: diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index b07fb1ddb8..611ef55007 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -1346,7 +1346,7 @@ class DecimalUsabilityTest(unittest.TestCase): #the same hash that to an int 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'))) diff --git a/Misc/NEWS b/Misc/NEWS index ca00d9b005..8f09b5f5ef 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -172,9 +172,6 @@ Library - 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 #1553375: logging: Added stack_info kwarg to display stack information.