Skip to content

Commit

Permalink
Fix compiler warning in _mpfr_hash()
Browse files Browse the repository at this point in the history
Also drop some inaccessible code in GMPy_MPC_Hash_Slot()
  • Loading branch information
skirpichev committed Nov 6, 2023
1 parent 21ccbf7 commit 6db2b4f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/gmpy2_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ _mpfr_hash(mpfr_t f)
}
else {
#if PY_VERSION_HEX >= 0x030A00A0
return PyBaseObject_Type.tp_hash(f);
/* The default object hash implementation in the CPython
* accepts void* pointer. */
return PyBaseObject_Type.tp_hash((PyObject*)f);
#else
return _PyHASH_NAN;
#endif
Expand Down Expand Up @@ -171,13 +173,7 @@ GMPy_MPC_Hash_Slot(MPC_Object *self)
}

hashreal = (Py_uhash_t)_mpfr_hash(mpc_realref(self->c));
if (hashreal == (Py_uhash_t)(-1)) {
return -1;
}
hashimag = (Py_uhash_t)_mpfr_hash(mpc_imagref(self->c));
if (hashimag == (Py_uhash_t)(-1)) {
return -1;
}
combined = hashreal + _PyHASH_IMAG * hashimag;
if (combined == (Py_uhash_t)(-1)) {
combined = (Py_uhash_t)(-2);
Expand Down

0 comments on commit 6db2b4f

Please sign in to comment.