https://github.com/python/cpython/commit/76f6b5e64a8b6ea5a88606f3665cd9f52c2c2798 commit: 76f6b5e64a8b6ea5a88606f3665cd9f52c2c2798 branch: main author: Kumar Aditya <kumaradi...@python.org> committer: kumaraditya303 <kumaradi...@python.org> date: 2025-04-02T20:01:05+05:30 summary:
gh-132013: use relaxed atomics in hash of frozenset (#132014) Use relaxed atomics in hash of `frozenset` to fix TSAN warning. files: M Objects/setobject.c 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; } _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com