numpy/numpy — pull request #482 by teoliphant (2012-10-10 04:51:26+00:00)
Title: BUG: Fix void_scalar hash function to use the elements of the record in ...

This PR improves the hash function calculation of VOID_SCALAR array scalars which are the elements returned from fully structured-array indexing. Prior to this PR, the hash of void scalars just used the pointer to the data which was not very helpful as this email demonstrates:

http://mail.scipy.org/pipermail/numpy-discussion/2011-August/058258.html

With this pull request, the hash function is computed using the same algorithm as Python's tuple's with the elements obtained by extracting objects from the array scalar. The field names are not used in determining the hash (but they are used in determining scalar equality).

There should be fewer surprises when using numpy void objects in Python dictionaries with this patch.