Skip to content

Commit fe3e623

Browse files
authored
gh-111178: Avoid calling long_hash from incompatible pointer type (GH-122972)
Make `long_hash` compatible with `hashfunc`.
1 parent 05fc4d7 commit fe3e623

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Objects/longobject.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -3614,8 +3614,9 @@ long_dealloc(PyObject *self)
36143614
}
36153615

36163616
static Py_hash_t
3617-
long_hash(PyLongObject *v)
3617+
long_hash(PyObject *obj)
36183618
{
3619+
PyLongObject *v = (PyLongObject *)obj;
36193620
Py_uhash_t x;
36203621
Py_ssize_t i;
36213622
int sign;
@@ -6607,7 +6608,7 @@ PyTypeObject PyLong_Type = {
66076608
&long_as_number, /* tp_as_number */
66086609
0, /* tp_as_sequence */
66096610
0, /* tp_as_mapping */
6610-
(hashfunc)long_hash, /* tp_hash */
6611+
long_hash, /* tp_hash */
66116612
0, /* tp_call */
66126613
0, /* tp_str */
66136614
PyObject_GenericGetAttr, /* tp_getattro */

0 commit comments

Comments
 (0)