]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-117657: Avoid race in `PAUSE_ADAPTIVE_COUNTER` in free-threaded build ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 30 Jul 2024 18:18:25 +0000 (20:18 +0200)
committerGitHub <noreply@github.com>
Tue, 30 Jul 2024 18:18:25 +0000 (18:18 +0000)
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>
Python/ceval_macros.h
Tools/tsan/suppressions_free_threading.txt

index 50941e4ec473e89e6a75ed8a82ce506ccd15c993..1ab83856fd99041e95c628e5083f5eab3ee11f9b 100644 (file)
@@ -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"
index 56cb33bfe64bcd9258673fa0209a5792fb633d09..6add088daef76ebc07b994e2dd69ab1c5bd61648 100644 (file)
@@ -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