summaryrefslogtreecommitdiff
path: root/Objects/setobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-08-01 10:57:42 -0700
committerRaymond Hettinger <python@rcn.com>2015-08-01 10:57:42 -0700
commit36c0500990a383a47228855bae712595f7f5e1d5 (patch)
tree38ae3abc0cd9572e426895cba367f3073481352f /Objects/setobject.c
parentfbffdef47dd711d2441ff415f00c72ae7102e80f (diff)
downloadcpython-git-36c0500990a383a47228855bae712595f7f5e1d5.tar.gz
Tweak the comments
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r--Objects/setobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 2d4d8cde6f..d638c13665 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -763,7 +763,7 @@ frozenset_hash(PyObject *self)
Py_uhash_t hash = 1927868237UL;
setentry *entry;
- /* Make hash(frozenset({0})) distinct from hash(frozenset()) */
+ /* Initial dispersion based on the number of active entries */
hash *= (Py_uhash_t)PySet_GET_SIZE(self) + 1;
/* Xor-in shuffled bits from every entry's hash field because xor is
@@ -790,8 +790,10 @@ frozenset_hash(PyObject *self)
/* Disperse patterns arising in nested frozensets */
hash = hash * 69069U + 907133923UL;
+ /* -1 is reserved as an error code */
if (hash == (Py_uhash_t)-1)
hash = 590923713UL;
+
so->hash = hash;
return hash;
}