Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d325c4b

Browse files
committed
Revert r86517
1 parent 2dad5ca commit d325c4b

3 files changed

Lines changed: 2 additions & 5 deletions

File tree

Lib/decimal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ def __hash__(self):
943943
# in the documentation. (See library docs, 'Built-in Types').
944944
if self._is_special:
945945
if self.is_snan():
946-
raise ValueError('Cannot hash a signaling NaN value.')
946+
raise TypeError('Cannot hash a signaling NaN value.')
947947
elif self.is_nan():
948948
return _PyHASH_NAN
949949
else:

Lib/test/test_decimal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ def hashit(d):
13461346

13471347
#the same hash that to an int
13481348
self.assertEqual(hashit(Decimal(23)), hashit(23))
1349-
self.assertRaises(ValueError, hash, Decimal('sNaN'))
1349+
self.assertRaises(TypeError, hash, Decimal('sNaN'))
13501350
self.assertTrue(hashit(Decimal('Inf')))
13511351
self.assertTrue(hashit(Decimal('-Inf')))
13521352

Misc/NEWS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ Library
172172

173173
- Issue #10465: fix broken delegating of attributes by gzip._PaddedFile.
174174

175-
- Issue #10356: hash(Decimal("sNaN")) now raises ValueError instead of
176-
TypeError.
177-
178175
- Issue #10356: Decimal.__hash__(-1) should return -2.
179176

180177
- Issue #1553375: logging: Added stack_info kwarg to display stack information.

0 commit comments

Comments
 (0)