summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2021-04-22 15:34:57 (GMT)
committerGitHub <noreply@github.com>2021-04-22 15:34:57 (GMT)
commita07da09ad5bd7d234ccd084a3a0933c290d1b592 (patch)
tree8c1ab67575527bd5c0c9452a74458ad5a29a1d08 /Modules
parentaccea7dc2bd30a6e8e1b0334acfca9585cbd7f8a (diff)
downloadcpython-a07da09ad5bd7d234ccd084a3a0933c290d1b592.zip
cpython-a07da09ad5bd7d234ccd084a3a0933c290d1b592.tar.gz
cpython-a07da09ad5bd7d234ccd084a3a0933c290d1b592.tar.bz2
bpo-43475: Fix worst case collision behavior for NaN instances (GH-25493)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_decimal/_decimal.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index 9a4329f..9b89fa4 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -4536,7 +4536,6 @@ _dec_hash(PyDecObject *v)
#error "No valid combination of CONFIG_64, CONFIG_32 and _PyHASH_BITS"
#endif
const Py_hash_t py_hash_inf = 314159;
- const Py_hash_t py_hash_nan = 0;
mpd_uint_t ten_data[1] = {10};
mpd_t ten = {MPD_POS|MPD_STATIC|MPD_CONST_DATA,
0, 2, 1, 1, ten_data};
@@ -4555,7 +4554,7 @@ _dec_hash(PyDecObject *v)
return -1;
}
else if (mpd_isnan(MPD(v))) {
- return py_hash_nan;
+ return _Py_HashPointer(v);
}
else {
return py_hash_inf * mpd_arith_sign(MPD(v));
@@ -5939,5 +5938,3 @@ error:
return NULL; /* GCOV_NOT_REACHED */
}
-
-