summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-10-17 20:54:53 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-10-17 20:54:53 (GMT)
commit8f67d0893f7170986b0ad370844318544270cbcc (patch)
tree4aec6cf093d4d042d18d1fadc3ce52765d32bd8d /Modules
parent6fb457526cef485d64f4f6744d81cae8c02032b3 (diff)
downloadcpython-8f67d0893f7170986b0ad370844318544270cbcc.zip
cpython-8f67d0893f7170986b0ad370844318544270cbcc.tar.gz
cpython-8f67d0893f7170986b0ad370844318544270cbcc.tar.bz2
make hashes always the size of pointers; introduce Py_hash_t #9778
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_datetimemodule.c14
-rw-r--r--Modules/_pickle.c2
2 files changed, 8 insertions, 8 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 9a04549..d791cde 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -1843,7 +1843,7 @@ delta_richcompare(PyObject *self, PyObject *other, int op)
static PyObject *delta_getstate(PyDateTime_Delta *self);
-static long
+static Py_hash_t
delta_hash(PyDateTime_Delta *self)
{
if (self->hashcode == -1) {
@@ -2777,11 +2777,11 @@ date_replace(PyDateTime_Date *self, PyObject *args, PyObject *kw)
/*
Borrowed from stringobject.c, originally it was string_hash()
*/
-static long
+static Py_hash_t
generic_hash(unsigned char *data, int len)
{
register unsigned char *p;
- register long x;
+ register Py_hash_t x;
p = (unsigned char *) data;
x = *p << 7;
@@ -2797,7 +2797,7 @@ generic_hash(unsigned char *data, int len)
static PyObject *date_getstate(PyDateTime_Date *self);
-static long
+static Py_hash_t
date_hash(PyDateTime_Date *self)
{
if (self->hashcode == -1)
@@ -3246,7 +3246,7 @@ timezone_richcompare(PyDateTime_TimeZone *self,
return delta_richcompare(self->offset, other->offset, op);
}
-static long
+static Py_hash_t
timezone_hash(PyDateTime_TimeZone *self)
{
return delta_hash((PyDateTime_Delta *)self->offset);
@@ -3751,7 +3751,7 @@ time_richcompare(PyObject *self, PyObject *other, int op)
return result;
}
-static long
+static Py_hash_t
time_hash(PyDateTime_Time *self)
{
if (self->hashcode == -1) {
@@ -4640,7 +4640,7 @@ datetime_richcompare(PyObject *self, PyObject *other, int op)
return result;
}
-static long
+static Py_hash_t
datetime_hash(PyDateTime_DateTime *self)
{
if (self->hashcode == -1) {
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 61db7cd..b810301 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -486,7 +486,7 @@ _PyMemoTable_Lookup(PyMemoTable *self, PyObject *key)
size_t mask = (size_t)self->mt_mask;
PyMemoEntry *table = self->mt_table;
PyMemoEntry *entry;
- long hash = (long)key >> 3;
+ Py_hash_t hash = (Py_hash_t)key >> 3;
i = hash & mask;
entry = &table[i];