Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d8b661dd
Commit
d8b661dd
authored
Nov 18, 2010
by
Stefan Krah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #10356: hash(Decimal("sNaN")) now raises ValueError instead of TypeError.
parent
d28f790b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
2 deletions
+5
-2
Lib/decimal.py
Lib/decimal.py
+1
-1
Lib/test/test_decimal.py
Lib/test/test_decimal.py
+1
-1
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/decimal.py
View file @
d8b661dd
...
...
@@ -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
Typ
eError
(
'Cannot hash a signaling NaN value.'
)
raise
Valu
eError
(
'Cannot hash a signaling NaN value.'
)
elif
self
.
is_nan
():
return
_PyHASH_NAN
else
:
...
...
Lib/test/test_decimal.py
View file @
d8b661dd
...
...
@@ -1346,7 +1346,7 @@ class DecimalUsabilityTest(unittest.TestCase):
#the same hash that to an int
self
.
assertEqual
(
hashit
(
Decimal
(
23
)),
hashit
(
23
))
self
.
assertRaises
(
Typ
eError
,
hash
,
Decimal
(
'sNaN'
))
self
.
assertRaises
(
Valu
eError
,
hash
,
Decimal
(
'sNaN'
))
self
.
assertTrue
(
hashit
(
Decimal
(
'Inf'
)))
self
.
assertTrue
(
hashit
(
Decimal
(
'-Inf'
)))
...
...
Misc/NEWS
View file @
d8b661dd
...
...
@@ -104,6 +104,9 @@ Core and Builtins
Library
-------
- 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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment