From 419929d8aa02b1e28411a166bcad5e1fe0c0ac00 Mon Sep 17 00:00:00 2001 From: parmeggiani Date: Tue, 21 May 2024 23:51:30 +0200 Subject: [PATCH] self-review --- Python/structmember.c | 5 +++++ Tools/tsan/suppressions_free_threading.txt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Python/structmember.c b/Python/structmember.c index 43b0b9c382400c..d65a4bc1f754eb 100644 --- a/Python/structmember.c +++ b/Python/structmember.c @@ -298,9 +298,14 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) break; case _Py_T_OBJECT: case Py_T_OBJECT_EX: +#ifndef Py_GIL_DISABLED + oldv = *(PyObject **)addr; + *(PyObject **)addr = Py_XNewRef(v); +#else _PyObject_SetMaybeWeakref(v); // without setting _Py_REF_MAYBE_WEAKREF, // we may get an infinite loop in PyMember_GetOne oldv = FT_ATOMIC_EXCHANGE_PTR(addr, Py_XNewRef(v)); +#endif Py_XDECREF(oldv); break; case Py_T_CHAR: { diff --git a/Tools/tsan/suppressions_free_threading.txt b/Tools/tsan/suppressions_free_threading.txt index b6fec7a8fd5431..2cc2ea82b846f9 100644 --- a/Tools/tsan/suppressions_free_threading.txt +++ b/Tools/tsan/suppressions_free_threading.txt @@ -30,7 +30,7 @@ race:_PyParkingLot_Park race_top:_add_to_weak_set race_top:_in_weak_set race_top:_mi_heap_delayed_free_partial -#race_top:_PyEval_EvalFrameDefault +race_top:_PyEval_EvalFrameDefault race_top:_PyImport_AcquireLock race_top:_PyImport_ReleaseLock # https://gist.github.com/mpage/0a24eb2dd458441ededb498e9b0e5de8