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
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
Prev Previous commit
Refactor _PyObject_HashFast
  • Loading branch information
aisk committed Jul 1, 2024
commit ef3d43835cb376ccc4ead6316e2a7a1f9d9f7236
13 changes: 6 additions & 7 deletions Include/internal/pycore_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,15 +617,14 @@ _PyObject_IS_GC(PyObject *obj)
static inline Py_hash_t
_PyObject_HashFast(PyObject *op)
{
Py_hash_t hash;
if (!PyUnicode_CheckExact(op) ||
(hash = FT_ATOMIC_LOAD_SSIZE_RELAXED(_PyASCIIObject_CAST(op)->hash)) == -1) {
hash = PyObject_Hash(op);
if (hash == -1) {
return -1;
if (PyUnicode_CheckExact(op)) {
Py_hash_t hash = FT_ATOMIC_LOAD_SSIZE_RELAXED(
_PyASCIIObject_CAST(op)->hash);
if (hash != -1) {
return hash;
}
}
return hash;
return PyObject_Hash(op);
}

// Fast inlined version of PyType_IS_GC()
Expand Down
Loading
0