Issue #14815: Use Py_ssize_t instead of long for the object hash, to
preserve all 64 bits of hash on Win64.
diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c
index 3c7d700..52530e6 100644
--- a/Modules/_randommodule.c
+++ b/Modules/_randommodule.c
@@ -234,10 +234,10 @@
if (PyLong_Check(arg))
n = PyNumber_Absolute(arg);
else {
- long hash = PyObject_Hash(arg);
+ Py_ssize_t hash = PyObject_Hash(arg);
if (hash == -1)
goto Done;
- n = PyLong_FromUnsignedLong((unsigned long)hash);
+ n = PyLong_FromSsize_t(hash);
}
if (n == NULL)
goto Done;