[issue9778] Make hash values the same width as a pointer (or Py_ssize_t)

Case Van Horsen report at bugs.python.org
Thu Oct 21 09:10:18 CEST 2010


Case Van Horsen <casevh at gmail.com> added the comment:

I've attached a patch that fixes hashing for numerical types, sys.hash_info is now correct, fixes typeobject.c/wrap_hashfunc and tupleobject.c/tuplehash to use Py_ssize_t instead of long, and uses Py_ssize_t instead of Py_hash_t.

I think it is clearer to use Py_ssize_t instead of Py_hash_t. I found two occurances where PyLong_FromLong needed to be replaced by PyLong_FromSsize_t and I think bugs like that would be easier to catch if Py_ssize_t is used.

----------
Added file: http://bugs.python.org/file19317/py_ssize_t_hash_patch.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9778>
_______________________________________


More information about the Python-bugs-list mailing list