From 79eec66e3dc277ea6ebad8c0b33756eea6a7ab3b Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Wed, 10 Apr 2024 10:20:05 -0400 Subject: [PATCH] gh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is enabled (#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. --- Include/pyport.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Include/pyport.h b/Include/pyport.h index 9d7ef006180..2ba81a4be42 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -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