make hashes always the size of pointers; introduce Py_hash_t #9778
diff --git a/Include/setobject.h b/Include/setobject.h
index 574caf7..023c5fa 100644
--- a/Include/setobject.h
+++ b/Include/setobject.h
@@ -22,11 +22,8 @@
#define PySet_MINSIZE 8
typedef struct {
- /* Cached hash code of the key. Note that hash codes are C longs.
- * We have to use Py_ssize_t instead because set_pop() abuses
- * the hash field to hold a search finger.
- */
- Py_ssize_t hash;
+ /* Cached hash code of the key. */
+ Py_hash_t hash;
PyObject *key;
} setentry;
@@ -53,10 +50,10 @@
* saves repeated runtime null-tests.
*/
setentry *table;
- setentry *(*lookup)(PySetObject *so, PyObject *key, long hash);
+ setentry *(*lookup)(PySetObject *so, PyObject *key, Py_hash_t hash);
setentry smalltable[PySet_MINSIZE];
- long hash; /* only used by frozenset objects */
+ Py_hash_t hash; /* only used by frozenset objects */
PyObject *weakreflist; /* List of weak references */
};
@@ -93,7 +90,7 @@
PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key);
PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key);
PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key);
-PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, long *hash);
+PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, Py_hash_t *hash);
PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set);
PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable);