summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-04-06 10:29:17 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-04-06 10:29:17 (GMT)
commit1472150cc2be26546d3699400d7cff8b75d07a03 (patch)
tree4e7493c1448d3d22210a1e53363d4fdef7f7cb09 /Objects
parentfdd4d0f5d6492f3a19f214841998a0abcd3a56d0 (diff)
downloadcpython-1472150cc2be26546d3699400d7cff8b75d07a03.zip
cpython-1472150cc2be26546d3699400d7cff8b75d07a03.tar.gz
cpython-1472150cc2be26546d3699400d7cff8b75d07a03.tar.bz2
Merged revisions 79809 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r79809 | mark.dickinson | 2010-04-05 19:54:51 +0100 (Mon, 05 Apr 2010) | 1 line Use a better NaN test in _Py_HashDouble as well. ........
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 0b22e38..4d3d659 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -656,9 +656,12 @@ _Py_HashDouble(double v)
* of mapping keys will turn out weird.
*/
- if (Py_IS_INFINITY(v))
- /* can't convert to long int -- arbitrary */
- v = v < 0 ? -271828.0 : 314159.0;
+ if (!Py_IS_FINITE(v)) {
+ if (Py_IS_INFINITY(v))
+ return v < 0 ? -271828 : 314159;
+ else
+ return 0;
+ }
fractpart = modf(v, &intpart);
if (fractpart == 0.0) {
/* This must return the same hash as an equal int or long. */