This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients mark.dickinson, njs, rhettinger, serhiy.storchaka, tim.peters
Date 2019-08-10.18:32:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565461960.41.0.979373812339.issue37807@roundup.psfhosted.org>
In-reply-to
Content
Currently the hash for integers and several other types uses 62 bits of 64 (on 64-bit platform). The domain of values is continuous:

    -sys.hash_info.modulus < h < sys.hash_info.modulus

If interpret Py_hash_t as Py_uhash_t, it will no longer be continuous:

    0 <= h < sys.hash_info.modulus or 2**sys.hash_info.width-sys.hash_info.modulus < h < 2**sys.hash_info.width

The hash for tuples is written in term of signed hashes of elements. If write it in Python it will look more complicated for unsigned hashes.

What are problems with using negative hash values? In hash tables you squeeze it to valid range by evaluating `h % size` of `h & mask`. Both expressions give non-negative result.
History
Date User Action Args
2019-08-10 18:32:40serhiy.storchakasetrecipients: + serhiy.storchaka, tim.peters, rhettinger, mark.dickinson, njs
2019-08-10 18:32:40serhiy.storchakasetmessageid: <1565461960.41.0.979373812339.issue37807@roundup.psfhosted.org>
2019-08-10 18:32:40serhiy.storchakalinkissue37807 messages
2019-08-10 18:32:40serhiy.storchakacreate