summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-04-05 18:09:39 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-04-05 18:09:39 (GMT)
commit5daab45158094e577b9791cda7d8a0f4e34f45cb (patch)
treebc65e628f6031555938699b90b611facb5d5a9ba /Objects/object.c
parent19192dd4022e1ce3978ac9b52a95deef430d46f8 (diff)
downloadcpython-5daab45158094e577b9791cda7d8a0f4e34f45cb.zip
cpython-5daab45158094e577b9791cda7d8a0f4e34f45cb.tar.gz
cpython-5daab45158094e577b9791cda7d8a0f4e34f45cb.tar.bz2
Merged revisions 79804 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r79804 | mark.dickinson | 2010-04-05 19:07:51 +0100 (Mon, 05 Apr 2010) | 5 lines 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 'Objects/object.c')
-rw-r--r--Objects/object.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/object.c b/Objects/object.c
index a332c6c..0b22e38 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -656,15 +656,15 @@ _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;
fractpart = modf(v, &intpart);
if (fractpart == 0.0) {
/* This must return the same hash as an equal int or long. */
if (intpart > LONG_MAX/2 || -intpart > LONG_MAX/2) {
/* Convert to long and use its hash. */
PyObject *plong; /* converted to Python long */
- if (Py_IS_INFINITY(intpart))
- /* can't convert to long int -- arbitrary */
- v = v < 0 ? -271828.0 : 314159.0;
plong = PyLong_FromDouble(v);
if (plong == NULL)
return -1;