Skip to content

Commit

Permalink
Backport PR pandas-dev#42360: BUG: fixes PyPy build (do not use _PyHA…
Browse files Browse the repository at this point in the history
…SH_Imag) (pandas-dev#42373)
  • Loading branch information
meeseeksmachine authored Jul 5, 2021
1 parent 263cc6c commit 5672766
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v1.3.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ including other versions of pandas.

Fixed regressions
~~~~~~~~~~~~~~~~~
-
- Pandas could not be built on PyPy (:issue:`42355`)
-

.. ---------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion pandas/_libs/src/klib/khash_python.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,16 @@ Py_hash_t PANDAS_INLINE floatobject_hash(PyFloatObject* key) {
}


#define _PandasHASH_IMAG 1000003UL

// replaces _Py_HashDouble with _Pandas_HashDouble
Py_hash_t PANDAS_INLINE complexobject_hash(PyComplexObject* key) {
Py_uhash_t realhash = (Py_uhash_t)_Pandas_HashDouble(key->cval.real);
Py_uhash_t imaghash = (Py_uhash_t)_Pandas_HashDouble(key->cval.imag);
if (realhash == (Py_uhash_t)-1 || imaghash == (Py_uhash_t)-1) {
return -1;
}
Py_uhash_t combined = realhash + _PyHASH_IMAG * imaghash;
Py_uhash_t combined = realhash + _PandasHASH_IMAG * imaghash;
if (combined == (Py_uhash_t)-1) {
return -2;
}
Expand Down

0 comments on commit 5672766

Please sign in to comment.