]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is enabled (#117702)
authorSam Gross <colesbury@gmail.com>
Wed, 10 Apr 2024 14:20:05 +0000 (10:20 -0400)
committerGitHub <noreply@github.com>
Wed, 10 Apr 2024 14:20:05 +0000 (10:20 -0400)
The `__has_feature(thread_sanitizer)` is a Clang-ism. Although new
versions of GCC implement `__has_feature`, the `defined(__has_feature)`
check still fails on GCC so we don't use that code path.

Include/pyport.h

index 9d7ef0061806ad9fff046283d965b33e4c9edb55..2ba81a4be42822655aaae94d675eae59a80d150f 100644 (file)
@@ -572,6 +572,9 @@ extern "C" {
 #  if defined(__SANITIZE_ADDRESS__)
 #    define _Py_ADDRESS_SANITIZER
 #  endif
+#  if defined(__SANITIZE_THREAD__)
+#    define _Py_THREAD_SANITIZER
+#  endif
 #endif