[Python-checkins] cpython: Issue #14815: Use Py_ssize_t instead of long for the object hash, to
larry.hastings
python-checkins at python.org
Sun Jun 24 10:54:42 CEST 2012
http://hg.python.org/cpython/rev/166599219bd4
changeset: 77680:166599219bd4
user: Larry Hastings <larry at hastings.org>
date: Sun Jun 24 01:54:21 2012 -0700
summary:
Issue #14815: Use Py_ssize_t instead of long for the object hash, to
preserve all 64 bits of hash on Win64.
files:
Misc/NEWS | 3 +++
Modules/_randommodule.c | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
Core and Builtins
-----------------
+- Issue #14815: Use Py_ssize_t instead of long for the object hash, to
+ preserve all 64 bits of hash on Win64.
+
- Issue #12268: File readline, readlines and read() or readall() methods
no longer lose data when an underlying read system call is interrupted.
IOError is no longer raised due to a read system call returning EINTR
diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c
--- 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;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list