summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-04-05 18:07:51 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-04-05 18:07:51 (GMT)
commit5e0c2748fb2e16b3b0f33f0bb55f1aaa1272f887 (patch)
tree3d55c3f2739f73ce600270027803ad35fe9f51ba /Lib
parent0c080097088217e350225bed9843dc64204febe7 (diff)
downloadcpython-5e0c2748fb2e16b3b0f33f0bb55f1aaa1272f887.zip
cpython-5e0c2748fb2e16b3b0f33f0bb55f1aaa1272f887.tar.gz
cpython-5e0c2748fb2e16b3b0f33f0bb55f1aaa1272f887.tar.bz2
Use a more robust infinity check in _Py_HashDouble.
This fixes a test_decimal failure on FreeBSD 8.0. (modf apparently doesn't follow C99 Annex F on FreeBSD.)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_float.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index b0f353b..bf9beec 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -948,6 +948,15 @@ class InfNanTest(unittest.TestCase):
self.assertFalse(NAN.is_inf())
self.assertFalse((0.).is_inf())
+ def test_hash_inf(self):
+ # the actual values here should be regarded as an
+ # implementation detail, but they need to be
+ # identical to those used in the Decimal module.
+ self.assertEqual(hash(float('inf')), 314159)
+ self.assertEqual(hash(float('-inf')), -271828)
+ self.assertEqual(hash(float('nan')), 0)
+
+
fromHex = float.fromhex
toHex = float.hex
class HexFloatTestCase(unittest.TestCase):