Skip to content

Commit

Permalink
pythongh-111178: Avoid calling long_hash from incompatible pointer t…
Browse files Browse the repository at this point in the history
…ype (pythonGH-122972)

Make `long_hash` compatible with `hashfunc`.
  • Loading branch information
picnixz authored and blhsing committed Aug 22, 2024
1 parent f17bcff commit 57512d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3614,8 +3614,9 @@ long_dealloc(PyObject *self)
}

static Py_hash_t
long_hash(PyLongObject *v)
long_hash(PyObject *obj)
{
PyLongObject *v = (PyLongObject *)obj;
Py_uhash_t x;
Py_ssize_t i;
int sign;
Expand Down Expand Up @@ -6607,7 +6608,7 @@ PyTypeObject PyLong_Type = {
&long_as_number, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
(hashfunc)long_hash, /* tp_hash */
long_hash, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
PyObject_GenericGetAttr, /* tp_getattro */
Expand Down

0 comments on commit 57512d7

Please sign in to comment.