Skip to content

Commit 58d99e7

Browse files
use relaxed atomics in hash of frozenset
1 parent b0f77c4 commit 58d99e7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Objects/setobject.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -793,12 +793,12 @@ frozenset_hash(PyObject *self)
793793
PySetObject *so = _PySet_CAST(self);
794794
Py_uhash_t hash;
795795

796-
if (so->hash != -1) {
797-
return so->hash;
796+
if (FT_ATOMIC_LOAD_SSIZE_RELAXED(so->hash) != -1) {
797+
return FT_ATOMIC_LOAD_SSIZE_RELAXED(so->hash);
798798
}
799799

800800
hash = frozenset_hash_impl(self);
801-
so->hash = hash;
801+
FT_ATOMIC_STORE_SSIZE_RELAXED(so->hash, hash);
802802
return hash;
803803
}
804804

0 commit comments

Comments
 (0)