]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is enabled (GH-11770...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 10 Apr 2024 14:38:10 +0000 (16:38 +0200)
committerGitHub <noreply@github.com>
Wed, 10 Apr 2024 14:38:10 +0000 (14:38 +0000)
gh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is enabled (GH-117702)

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.
(cherry picked from commit 79eec66e3dc277ea6ebad8c0b33756eea6a7ab3b)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Include/pyport.h

index 30b9c8ebc409f0f2b88321a8128ac419f65a9b1e..e2bac3bf50426173a744d1d82666a3477458179a 100644 (file)
@@ -757,6 +757,9 @@ extern char * _getpty(int *, int, mode_t, int);
 #  if defined(__SANITIZE_ADDRESS__)
 #    define _Py_ADDRESS_SANITIZER
 #  endif
+#  if defined(__SANITIZE_THREAD__)
+#    define _Py_THREAD_SANITIZER
+#  endif
 #endif