Skip to content
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
use _Py_THREAD_SANITIZER macro for performance reasons
  • Loading branch information
wrongnull committed Feb 5, 2025
commit d7cb09fd4761e541070e551b2439f29ece31289a
9 changes: 8 additions & 1 deletion Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -2485,12 +2485,19 @@ new_reference(PyObject *op)
op->ob_refcnt = 1;
#endif
#else
_Py_atomic_store_uintptr_relaxed(&op->ob_tid, _Py_ThreadId());
op->ob_flags = 0;
op->ob_mutex = (PyMutex){ 0 };
#ifdef _Py_THREAD_SANITIZER
_Py_atomic_store_uintptr_relaxed(&op->ob_tid, _Py_ThreadId());
_Py_atomic_store_uint8_relaxed(&op->ob_gc_bits, 0);
_Py_atomic_store_uint32_relaxed(&op->ob_ref_local, 1);
_Py_atomic_store_ssize_relaxed(&op->ob_ref_shared, 0);
#else
op->ob_tid = _Py_ThreadId();
op->ob_gc_bits = 0;
op->ob_ref_local = 1;
op->ob_ref_shared = 0;
#endif
#endif
#ifdef Py_TRACE_REFS
_Py_AddToAllObjects(op);
Expand Down