File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 TypeError ('Cannot hash a signaling NaN value.' )
946+ raise ValueError ('Cannot hash a signaling NaN value.' )
947947 elif self .is_nan ():
948948 return _PyHASH_NAN
949949 else :
Original file line number Diff line number Diff 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 (TypeError , hash , Decimal ('sNaN' ))
1349+ self .assertRaises (ValueError , hash , Decimal ('sNaN' ))
13501350 self .assertTrue (hashit (Decimal ('Inf' )))
13511351 self .assertTrue (hashit (Decimal ('-Inf' )))
13521352
Original file line number Diff line number Diff line change @@ -104,6 +104,9 @@ Core and Builtins
104104Library
105105-------
106106
107+ - Issue #10356: hash(Decimal("sNaN")) now raises ValueError instead of
108+ TypeError.
109+
107110- Issue #10356: Decimal.__hash__(-1) should return -2.
108111
109112- Issue #1553375: logging: Added stack_info kwarg to display stack information.
You can’t perform that action at this time.
0 commit comments