BUG: nan-objects lookup fails with Python3.10 by realead · Pull Request #41988 · pandas-dev/pandas (original) (raw)
- closes BUG: nan-objects lookup fails in Python3.10 #41953
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
This builds upon #41952, which should be integrated first.
We no longer can assume that the CPython's hash function for elements with NaN (float, complex, tuple) will do the right thing (see python/cpython@a07da09) and thus need to replace the default CPython's hash-function with our own, similar to the way we handle equality-operator.
We need to use old CPython hash functions for float
and complex
, because we would like to keep the equivalency int(k)==float(k)==complex(k, 0.0)
.
We have more freedom with tuple's hash-function, but still use CPython's implementation, so we get old hash-values.