Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this result for hash('') expected? #3

Open
william-ml-leslie opened this issue Feb 28, 2017 · 2 comments
Open

Is this result for hash('') expected? #3

william-ml-leslie opened this issue Feb 28, 2017 · 2 comments

Comments

@william-ml-leslie
Copy link
Contributor

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
>>>>

@antocuni
Copy link
Owner

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?

@william-ml-leslie
Copy link
Contributor Author

It's a squeaky_pl portable build. pypy56 has hash('') == -2, but I normally test against 5.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants