capnpy
capnpy copied to clipboard
Is this result for hash('') expected?
test_strhash
def test_strhash():
expected_hash_empty_string = 0
if IS_PYPY:
expected_hash_empty_string = -2
#
h = _hash.strhash
> assert h('', 0, 0) == hash('') == expected_hash_empty_string E assert -1 == -2 E + where -1 = hash('')
is_pypy
[wleslie@dirac:~/src/capnpy] 18:15:38 $ pypy Python 2.7.10 (7e8df3df96417c16c2d55b41352ec82c9c69c978, Jun 24 2016, 11:49:45) [PyPy 5.3.1 with GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>> hash('') -1 >>>>
That's weird:
$ pypy
Python 2.7.13 (3fbdd036db1c, Feb 26 2017, 23:00:12)
[PyPy 5.7.0-alpha0 with GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``< arigato> then what occurs? <
fijal> good stuff I believe''
>>>> hash("")
-2
Where did you get your pypy from?
It's a squeaky_pl portable build. pypy56 has hash('') == -2
, but I normally test against 5.3.