[Python-Dev] Hash randomization for which types? (original) (raw)
Larry Hastings larry at hastings.org
Wed Feb 17 09:05:24 EST 2016
- Previous message (by thread): [Python-Dev] Hash randomization for which types?
- Next message (by thread): [Python-Dev] Disabling changing sys.argv[0] with runpy.run_module(...alter_sys=True)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 02/17/2016 08:49 AM, Chris Angelico wrote:
On Thu, Feb 18, 2016 at 12:29 AM, Larry Hastings <larry at hastings.org> wrote:
int objects have their own hash algorithm, built in to longhash() in Objects/longobject.c. The hash of an int is the value of the int, unless it's -1 or doesn't fit into the native type. Can someone elaborate on this special case, please? I can see the code there, but there's no comment. Is there some value in not hashing to -1?
Returning -1 indicates an error / exception. So hash functions never return -1 as a hash value.
//arry/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160217/d64c7271/attachment.html>
- Previous message (by thread): [Python-Dev] Hash randomization for which types?
- Next message (by thread): [Python-Dev] Disabling changing sys.argv[0] with runpy.run_module(...alter_sys=True)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]