From 58d99e73316bf34daf48543610066a93c34df6ea Mon Sep 17 00:00:00 2001 From: Kumar Aditya Date: Wed, 2 Apr 2025 19:13:24 +0530 Subject: [PATCH] use relaxed atomics in hash of frozenset --- Objects/setobject.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Objects/setobject.c b/Objects/setobject.c index 5ad83c3f1633b9..f65d458f7924c3 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -793,12 +793,12 @@ frozenset_hash(PyObject *self) PySetObject *so = _PySet_CAST(self); Py_uhash_t hash; - if (so->hash != -1) { - return so->hash; + if (FT_ATOMIC_LOAD_SSIZE_RELAXED(so->hash) != -1) { + return FT_ATOMIC_LOAD_SSIZE_RELAXED(so->hash); } hash = frozenset_hash_impl(self); - so->hash = hash; + FT_ATOMIC_STORE_SSIZE_RELAXED(so->hash, hash); return hash; }