Skip to content

Commit

Permalink
gh-117657: Fix race data race in _Py_IsOwnedByCurrentThread() (#118258
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mpage committed Apr 26, 2024
1 parent 5a4d3df commit a5eeb83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Include/object.h
Expand Up @@ -303,7 +303,11 @@ _Py_ThreadId(void)
static inline Py_ALWAYS_INLINE int
_Py_IsOwnedByCurrentThread(PyObject *ob)
{
#ifdef _Py_THREAD_SANITIZER
return _Py_atomic_load_uintptr_relaxed(&ob->ob_tid) == _Py_ThreadId();
#else
return ob->ob_tid == _Py_ThreadId();
#endif
}
#endif

Expand Down
1 change: 0 additions & 1 deletion Tools/tsan/suppressions_free_threading.txt
Expand Up @@ -14,7 +14,6 @@ race:set_allocator_unlocked
race:_add_to_weak_set
race:_in_weak_set
race:_mi_heap_delayed_free_partial
race:_Py_IsOwnedByCurrentThread
race:_PyEval_EvalFrameDefault
race:_PyFunction_SetVersion
race:_PyImport_AcquireLock
Expand Down

0 comments on commit a5eeb83

Please sign in to comment.