Use a better NaN test in _Py_HashDouble as well.
This commit is contained in:
parent
e1d665a90e
commit
56506a6ed2
|
@ -1025,9 +1025,12 @@ _Py_HashDouble(double v)
|
||||||
* of mapping keys will turn out weird.
|
* of mapping keys will turn out weird.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (Py_IS_INFINITY(v))
|
if (!Py_IS_FINITE(v)) {
|
||||||
/* can't convert to long int -- arbitrary */
|
if (Py_IS_INFINITY(v))
|
||||||
v = v < 0 ? -271828.0 : 314159.0;
|
return v < 0 ? -271828 : 314159;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
fractpart = modf(v, &intpart);
|
fractpart = modf(v, &intpart);
|
||||||
if (fractpart == 0.0) {
|
if (fractpart == 0.0) {
|
||||||
/* This must return the same hash as an equal int or long. */
|
/* This must return the same hash as an equal int or long. */
|
||||||
|
|
Loading…
Reference in New Issue