mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
bpo-43475: Fix worst case collision behavior for NaN instances (GH-25493)
This commit is contained in:
parent
accea7dc2b
commit
a07da09ad5
10 changed files with 25 additions and 21 deletions
|
@ -412,10 +412,10 @@ static Py_hash_t
|
|||
complex_hash(PyComplexObject *v)
|
||||
{
|
||||
Py_uhash_t hashreal, hashimag, combined;
|
||||
hashreal = (Py_uhash_t)_Py_HashDouble(v->cval.real);
|
||||
hashreal = (Py_uhash_t)_Py_HashDouble((PyObject *) v, v->cval.real);
|
||||
if (hashreal == (Py_uhash_t)-1)
|
||||
return -1;
|
||||
hashimag = (Py_uhash_t)_Py_HashDouble(v->cval.imag);
|
||||
hashimag = (Py_uhash_t)_Py_HashDouble((PyObject *)v, v->cval.imag);
|
||||
if (hashimag == (Py_uhash_t)-1)
|
||||
return -1;
|
||||
/* Note: if the imaginary part is 0, hashimag is 0 now,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue