|
| 1 | +diff --git a/pandas/_libs/include/pandas/vendored/klib/khash_python.h b/pandas/_libs/include/pandas/vendored/klib/khash_python.h |
| 2 | +index 5a933b4..f579fc6 100644 |
| 3 | +--- a/pandas/_libs/include/pandas/vendored/klib/khash_python.h |
| 4 | ++++ b/pandas/_libs/include/pandas/vendored/klib/khash_python.h |
| 5 | +@@ -173,13 +173,15 @@ static inline int floatobject_cmp(PyFloatObject *a, PyFloatObject *b) { |
| 6 | + // PyObject_RichCompareBool for complexobjects has a different behavior |
| 7 | + // needs to be replaced |
| 8 | + static inline int complexobject_cmp(PyComplexObject *a, PyComplexObject *b) { |
| 9 | +- return (Py_IS_NAN(a->cval.real) && Py_IS_NAN(b->cval.real) && |
| 10 | +- Py_IS_NAN(a->cval.imag) && Py_IS_NAN(b->cval.imag)) || |
| 11 | +- (Py_IS_NAN(a->cval.real) && Py_IS_NAN(b->cval.real) && |
| 12 | +- a->cval.imag == b->cval.imag) || |
| 13 | +- (a->cval.real == b->cval.real && Py_IS_NAN(a->cval.imag) && |
| 14 | +- Py_IS_NAN(b->cval.imag)) || |
| 15 | +- (a->cval.real == b->cval.real && a->cval.imag == b->cval.imag); |
| 16 | ++ Py_complex a_cval = PyComplex_AsCComplex((PyObject*)a); |
| 17 | ++ Py_complex b_cval = PyComplex_AsCComplex((PyObject*)b); |
| 18 | ++ return (Py_IS_NAN(a_cval.real) && Py_IS_NAN(b_cval.real) && |
| 19 | ++ Py_IS_NAN(a_cval.imag) && Py_IS_NAN(b_cval.imag)) || |
| 20 | ++ (Py_IS_NAN(a_cval.real) && Py_IS_NAN(b_cval.real) && |
| 21 | ++ a_cval.imag == b_cval.imag) || |
| 22 | ++ (a_cval.real == b_cval.real && Py_IS_NAN(a_cval.imag) && |
| 23 | ++ Py_IS_NAN(b_cval.imag)) || |
| 24 | ++ (a_cval.real == b_cval.real && a_cval.imag == b_cval.imag); |
| 25 | + } |
| 26 | + |
| 27 | + static inline int pyobject_cmp(PyObject *a, PyObject *b); |
| 28 | +@@ -250,8 +252,9 @@ static inline Py_hash_t floatobject_hash(PyFloatObject *key) { |
| 29 | + |
| 30 | + // replaces _Py_HashDouble with _Pandas_HashDouble |
| 31 | + static inline Py_hash_t complexobject_hash(PyComplexObject *key) { |
| 32 | +- Py_uhash_t realhash = (Py_uhash_t)_Pandas_HashDouble(key->cval.real); |
| 33 | +- Py_uhash_t imaghash = (Py_uhash_t)_Pandas_HashDouble(key->cval.imag); |
| 34 | ++ Py_complex cval = PyComplex_AsCComplex((PyObject*)key); |
| 35 | ++ Py_uhash_t realhash = (Py_uhash_t)_Pandas_HashDouble(cval.real); |
| 36 | ++ Py_uhash_t imaghash = (Py_uhash_t)_Pandas_HashDouble(cval.imag); |
| 37 | + if (realhash == (Py_uhash_t)-1 || imaghash == (Py_uhash_t)-1) { |
| 38 | + return -1; |
| 39 | + } |
| 40 | +diff --git a/pyproject.toml b/pyproject.toml |
| 41 | +index db9f055..c191232 100644 |
| 42 | +--- a/pyproject.toml |
| 43 | ++++ b/pyproject.toml |
| 44 | +@@ -5,7 +5,7 @@ requires = [ |
| 45 | + "meson-python==0.13.1", |
| 46 | + "meson==1.2.1", |
| 47 | + "wheel", |
| 48 | +- "Cython~=3.0.5", # Note: sync with setup.py, environment.yml and asv.conf.json |
| 49 | ++ "Cython==3.0.10", # Note: sync with setup.py, environment.yml and asv.conf.json |
| 50 | + # Force numpy higher than 2.0, so that built wheels are compatible |
| 51 | + # with both numpy 1 and 2 |
| 52 | + "numpy>=2.0", |
0 commit comments