diff options
author | Larry Hastings <larry@hastings.org> | 2012-06-24 08:54:21 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2012-06-24 08:54:21 (GMT) |
commit | 49c15d4a5fa139bf2d154112709a8b29c9d5d678 (patch) | |
tree | 1b6402adf739a7fbfabe6cd8ab24ed4e8b29529d | |
parent | 1bc276d7ab567ff5ef216a213e851e317b909529 (diff) | |
download | cpython-49c15d4a5fa139bf2d154112709a8b29c9d5d678.zip cpython-49c15d4a5fa139bf2d154112709a8b29c9d5d678.tar.gz cpython-49c15d4a5fa139bf2d154112709a8b29c9d5d678.tar.bz2 |
Issue #14815: Use Py_ssize_t instead of long for the object hash, to
preserve all 64 bits of hash on Win64.
-rw-r--r-- | Misc/NEWS | 3 | ||||
-rw-r--r-- | Modules/_randommodule.c | 4 |
2 files changed, 5 insertions, 2 deletions
@@ -10,6 +10,9 @@ What's New in Python 3.3.0 Beta 1? 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 index 3c7d700..52530e6 100644 --- a/Modules/_randommodule.c +++ b/Modules/_randommodule.c @@ -234,10 +234,10 @@ random_seed(RandomObject *self, PyObject *args) 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; |