[Python-checkins] r79823 - in python/branches/py3k: Objects/object.c

mark.dickinson python-checkins at python.org
Tue Apr 6 12:29:17 CEST 2010


Author: mark.dickinson
Date: Tue Apr  6 12:29:17 2010
New Revision: 79823

Log:
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.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Objects/object.c

Modified: python/branches/py3k/Objects/object.c
==============================================================================
--- python/branches/py3k/Objects/object.c	(original)
+++ python/branches/py3k/Objects/object.c	Tue Apr  6 12:29:17 2010
@@ -656,9 +656,12 @@
 	 * 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. */


More information about the Python-checkins mailing list