[pypy-issue] [issue1088] numpypy array scalars do not hash nicely

Ken Watford tracker at bugs.pypy.org
Tue Mar 13 02:05:12 CET 2012

New submission from Ken Watford <kwatford at gmail.com>:

>>>> from numpypy import int8
>>>> assert hash(int8(0)) == hash(int8(0))
Traceback (most recent call last):
  File "<console>", line 1, in <module>

Array scalars in real numpy normally hash to the same value as the equivalent 
python scalars. Especially since their reprs are the same. While debugging some 
code of mine I came across something like this:

>>>> print {0: 'wtf', int8(0): 'foo', int8(0): 'bar'}
{0: 'wtf', 0: 'foo', 0: 'bar'}

Except with several thousand pairs. It was slightly surreal until I thought about 
where the supposed zeros were coming from.

messages: 4090
nosy: kw, pypy-issue
priority: bug
status: unread
title: numpypy array scalars do not hash nicely

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list