gh-117657: Fix race data race in _Py_IsOwnedByCurrentThread() (#118258)

This commit is contained in:
mpage 2024-04-26 07:39:08 -07:00 committed by GitHub
parent 5a4d3df2fa
commit a5eeb832c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -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