https://github.com/python/cpython/commit/fe3e623562fb058ef7b8fd6d90ac5098a3b05816
commit: fe3e623562fb058ef7b8fd6d90ac5098a3b05816
branch: main
author: Bénédikt Tran <[email protected]>
committer: encukou <[email protected]>
date: 2024-08-14T11:50:35+02:00
summary:
gh-111178: Avoid calling long_hash from incompatible pointer type (GH-122972)
Make `long_hash` compatible with `hashfunc`.
files:
M Objects/longobject.c
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 050ce1a7303842..7239d685fdf740 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -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;
@@ -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 */
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]