Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a5eeb83

Browse filesBrowse files
authored
gh-117657: Fix race data race in _Py_IsOwnedByCurrentThread() (#118258)
1 parent 5a4d3df commit a5eeb83
Copy full SHA for a5eeb83

File tree

Expand file treeCollapse file tree

2 files changed

+4
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-1
lines changed

‎Include/object.h

Copy file name to clipboardExpand all lines: Include/object.h
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,11 @@ _Py_ThreadId(void)
303303
static inline Py_ALWAYS_INLINE int
304304
_Py_IsOwnedByCurrentThread(PyObject *ob)
305305
{
306+
#ifdef _Py_THREAD_SANITIZER
307+
return _Py_atomic_load_uintptr_relaxed(&ob->ob_tid) == _Py_ThreadId();
308+
#else
306309
return ob->ob_tid == _Py_ThreadId();
310+
#endif
307311
}
308312
#endif
309313

‎Tools/tsan/suppressions_free_threading.txt

Copy file name to clipboardExpand all lines: Tools/tsan/suppressions_free_threading.txt
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ race:set_allocator_unlocked
1414
race:_add_to_weak_set
1515
race:_in_weak_set
1616
race:_mi_heap_delayed_free_partial
17-
race:_Py_IsOwnedByCurrentThread
1817
race:_PyEval_EvalFrameDefault
1918
race:_PyFunction_SetVersion
2019
race:_PyImport_AcquireLock

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.