Index: Objects/object.c =================================================================== --- Objects/object.c (révision 69444) +++ Objects/object.c (copie de travail) @@ -1073,7 +1073,22 @@ _Py_HashPointer(void *p) { #if SIZEOF_LONG >= SIZEOF_VOID_P - return (long)p; + unsigned long x = (unsigned long)p; + /* bottom 3 bits are likely to be 0; rotate them to the top to avoid + excessive hash collisions for dicts and sets */ + x = (x >> 4) + (x & 15); + if (x == -1) + x = -2; + return x; +/* 64-bit Windows has sizeof(long) == 4 and sizeof(void *) == 8 */ +#elif SIZEOF_VOID_P == SIZEOF_LONG*2 + unsigned long x; + size_t y = (size_t)p; + y = (y >> 4) + (y & 15); + x = (unsigned long)y + (unsigned long)(y >> 8*SIZEOF_LONG); + if (x == -1) + x = -2; + return x; #else /* convert to a Python long and hash that */ PyObject* longobj;