Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warning in _mpfr_hash() #453

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading