[pypy-dev] Hash compatibility between PyPy and CPython
Manuel Jacob
me at manueljacob.de
Fri Jun 1 19:24:50 EDT 2018
Hi,
Do we in general try to stay compatible with the hashes of CPython?
I'm currently debugging a failure in lib-python's test_hash on linux32
in the py3.5 branch [1]. The test fails because currently on PyPy3.5,
hash(int(-2**31)) == -2147483648 while hash(float(-2**31)) == -2. On
CPython 3.6.5, both are -2.
It seems like our float hashes are 100% compatible with CPython, but our
int hashes are different in some cases (like the one above). In any
case, i think that the invariant hash(i) == hash(float(i)) should hold
for any int i that can be represented exactly by a float. Now the
question is: should we change our int hash to be compatible with
CPython?
-Manuel
[1]
http://buildbot.pypy.org/summary/longrepr?testname=unmodified&builder=pypy-c-jit-linux-x86-32&build=4661&mod=lib-python.3.test.test_hash
More information about the pypy-dev
mailing list