summaryrefslogtreecommitdiffstats
path: root/Include/Python.h
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-06-10 12:01:22 (GMT)
committerGitHub <noreply@github.com>2021-06-10 12:01:22 (GMT)
commit865269458fde83f58f056d02a777e4328c763880 (patch)
tree10ba6ac9b6556a870562fdf852604e9c8570752a /Include/Python.h
parentd9f38d77c870cdb04273914c92fa4fe92b830d88 (diff)
downloadcpython-865269458fde83f58f056d02a777e4328c763880.zip
cpython-865269458fde83f58f056d02a777e4328c763880.tar.gz
cpython-865269458fde83f58f056d02a777e4328c763880.tar.bz2
bpo-44363: Get test_capi passing with address sanitizer (GH-26639)
(cherry picked from commit 31aa0dbff4c1d39c9d77c6c8f4a61d0e46c1268b) Co-authored-by: Mark Shannon <mark@hotpy.org>
Diffstat (limited to 'Include/Python.h')
-rw-r--r--Include/Python.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/Include/Python.h b/Include/Python.h
index dcd0a57..acee38c 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -63,13 +63,22 @@
#include "pyport.h"
#include "pymacro.h"
-/* A convenient way for code to know if clang's memory sanitizer is enabled. */
+/* A convenient way for code to know if sanitizers are enabled. */
#if defined(__has_feature)
# if __has_feature(memory_sanitizer)
# if !defined(_Py_MEMORY_SANITIZER)
# define _Py_MEMORY_SANITIZER
# endif
# endif
+# if __has_feature(address_sanitizer)
+# if !defined(_Py_ADDRESS_SANITIZER)
+# define _Py_ADDRESS_SANITIZER
+# endif
+# endif
+#elif defined(__GNUC__)
+# if defined(__SANITIZE_ADDRESS__)
+# define _Py_ADDRESS_SANITIZER
+# endif
#endif
/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.