Hash compatibility between PyPy and CPython
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
Hi Manuel, On 2 June 2018 at 01:24, Manuel Jacob <me@manueljacob.de> wrote:
that can be represented exactly by a float. Now the question is: should we change our int hash to be compatible with CPython?
Yes, I think so. We already jump through hoops to make the int hash compatible with CPython. Apparently, we fail on 32-bit. We should just fix it. Armin
participants (2)
-
Armin Rigo
-
Manuel Jacob