summaryrefslogtreecommitdiff
path: root/Include/dictobject.h
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-10-17 20:54:53 +0000
committerBenjamin Peterson <benjamin@python.org>2010-10-17 20:54:53 +0000
commit8c3324e313c1adb92a1e38bbcbaa494bf97b754d (patch)
tree25e2c647d7ba30fae6dd1d0446b9eaa6997c17e8 /Include/dictobject.h
parent7ce1b2b4dc3414cd9e8bca771ee92a52e67db390 (diff)
downloadcpython-8c3324e313c1adb92a1e38bbcbaa494bf97b754d.tar.gz
make hashes always the size of pointers; introduce Py_hash_t #9778
Diffstat (limited to 'Include/dictobject.h')
-rw-r--r--Include/dictobject.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/Include/dictobject.h b/Include/dictobject.h
index 2481921949..024a688d2a 100644
--- a/Include/dictobject.h
+++ b/Include/dictobject.h
@@ -48,11 +48,8 @@ meaning otherwise.
#define PyDict_MINSIZE 8
typedef struct {
- /* Cached hash code of me_key. Note that hash codes are C longs.
- * We have to use Py_ssize_t instead because dict_popitem() abuses
- * me_hash to hold a search finger.
- */
- Py_ssize_t me_hash;
+ /* Cached hash code of me_key. */
+ Py_hash_t me_hash;
PyObject *me_key;
PyObject *me_value;
} PyDictEntry;
@@ -84,7 +81,7 @@ struct _dictobject {
* setitem calls.
*/
PyDictEntry *ma_table;
- PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash);
+ PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, Py_hash_t hash);
PyDictEntry ma_smalltable[PyDict_MINSIZE];
};
@@ -116,14 +113,14 @@ PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
PyAPI_FUNC(int) PyDict_Next(
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
PyAPI_FUNC(int) _PyDict_Next(
- PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash);
+ PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp);
PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp);
PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key);
-PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, long hash);
+PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash);
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);