Make `long_hash` compatible with `hashfunc` · python/cpython@cd63f58

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 */