8000 gh-117657: Fix data races reported by TSAN in some set methods by aisk · Pull Request #120914 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-117657: Fix data races reported by TSAN in some set methods #120914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix data races reported by TSAN in some set methods
  • Loading branch information
aisk committed Jun 23, 2024
commit 64f07da0fad4bee7b3a74eaab2b884a9252a0df5
6 changes: 3 additions & 3 deletions Objects/setobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ set_add_key(PySetObject *so, PyObject *key)
Py_hash_t hash;

if (!PyUnicode_CheckExact(key) ||
(hash = _PyASCIIObject_CAST(key)->hash) == -1) {
(hash = FT_ATOMIC_LOAD_SSIZE_RELAXED(_PyASCIIObject_CAST(key)->hash)) == -1) {
hash = PyObject_Hash(key);
if (hash == -1)
return -1;
Expand All @@ -382,7 +382,7 @@ set_contains_key(PySetObject *so, PyObject *key)
Py_hash_t hash;

if (!PyUnicode_CheckExact(key) ||
(hash = _PyASCIIObject_CAST(key)->hash) == -1) {
(hash = FT_ATOMIC_LOAD_SSIZE_RELAXED(_PyASCIIObject_CAST(key)->hash)) == -1) {
hash = PyObject_Hash(key);
if (hash == -1)
return -1;
Expand All @@ -396,7 +396,7 @@ set_discard_key(PySetObject *so, PyObject *key)
Py_hash_t hash;

if (!PyUnicode_CheckExact(key) ||
(hash = _PyASCIIObject_CAST(key)->hash) == -1) {
(hash = FT_ATOMIC_LOAD_SSIZE_RELAXED(_PyASCIIObject_CAST(key)->hash)) == -1) {
hash = PyObject_Hash(key);
if (hash == -1)
return -1;
Expand Down
1 change: 0 additions & 1 deletion Tools/tsan/suppressions_free_threading.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ race_top:assign_version_tag
race_top:insertdict
race_top:lookup_tp_dict
race_top:new_reference
race_top:set_contains_key
# https://gist.github.com/colesbury/d13d033f413b4ad07929d044bed86c35
race_top:set_discard_entry
race_top:_PyDict_CheckConsistency
Expand Down
Loading
0