summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-07-30 18:18:25 (GMT)
committerGitHub <noreply@github.com>2024-07-30 18:18:25 (GMT)
commit8e96d85386883684e2a77ac70696e2bee50f6306 (patch)
tree8c3d03263b4f62676e3ccca7f9f17f14a5a2dce8
parent1912f94f60ddaea78afe1ff70f098859790f9595 (diff)
downloadcpython-8e96d85386883684e2a77ac70696e2bee50f6306.zip
cpython-8e96d85386883684e2a77ac70696e2bee50f6306.tar.gz
cpython-8e96d85386883684e2a77ac70696e2bee50f6306.tar.bz2
[3.13] gh-117657: Avoid race in `PAUSE_ADAPTIVE_COUNTER` in free-threaded build (GH-122190) (#122475)
The adaptive counter doesn't do anything currently in the free-threaded build and TSan reports a data race due to concurrent modifications to the counter. (cherry picked from commit 2b163aa9e796b312bb0549d49145d26e4904768e) Co-authored-by: Sam Gross <colesbury@gmail.com>
-rw-r--r--Python/ceval_macros.h3
-rw-r--r--Tools/tsan/suppressions_free_threading.txt1
2 files changed, 2 insertions, 2 deletions
diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h
index 50941e4..1ab8385 100644
--- a/Python/ceval_macros.h
+++ b/Python/ceval_macros.h
@@ -314,17 +314,18 @@ GETITEM(PyObject *v, Py_ssize_t i) {
/* gh-115999 tracks progress on addressing this. */ \
static_assert(0, "The specializing interpreter is not yet thread-safe"); \
} while (0);
+#define PAUSE_ADAPTIVE_COUNTER(COUNTER) ((void)COUNTER)
#else
#define ADVANCE_ADAPTIVE_COUNTER(COUNTER) \
do { \
(COUNTER) = advance_backoff_counter((COUNTER)); \
} while (0);
-#endif
#define PAUSE_ADAPTIVE_COUNTER(COUNTER) \
do { \
(COUNTER) = pause_backoff_counter((COUNTER)); \
} while (0);
+#endif
#define UNBOUNDLOCAL_ERROR_MSG \
"cannot access local variable '%s' where it is not associated with a value"
diff --git a/Tools/tsan/suppressions_free_threading.txt b/Tools/tsan/suppressions_free_threading.txt
index 56cb33b..6add088 100644
--- a/Tools/tsan/suppressions_free_threading.txt
+++ b/Tools/tsan/suppressions_free_threading.txt
@@ -23,7 +23,6 @@ race:free_threadstate
# These warnings trigger directly in a CPython function.
-race_top:_PyEval_EvalFrameDefault
race_top:assign_version_tag
race_top:new_reference
race_top:_multiprocessing_SemLock_acquire_impl