mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-132013: use relaxed atomics in hash of frozenset (#132014)
Use relaxed atomics in hash of `frozenset` to fix TSAN warning.
This commit is contained in:
parent
b0f77c4d25
commit
76f6b5e64a
1 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue