]> granicus.if.org Git - python/commitdiff
closes bpo-31696: don't mention GCC in sys.version when building with clang (#3891)
authorBenjamin Peterson <benjamin@python.org>
Fri, 6 Oct 2017 04:15:14 +0000 (21:15 -0700)
committerGitHub <noreply@github.com>
Fri, 6 Oct 2017 04:15:14 +0000 (21:15 -0700)
Misc/NEWS.d/next/Build/2017-10-04-23-40-32.bpo-31696.Y3_aBV.rst [new file with mode: 0644]
Python/getcompiler.c

diff --git a/Misc/NEWS.d/next/Build/2017-10-04-23-40-32.bpo-31696.Y3_aBV.rst b/Misc/NEWS.d/next/Build/2017-10-04-23-40-32.bpo-31696.Y3_aBV.rst
new file mode 100644 (file)
index 0000000..00aae0b
--- /dev/null
@@ -0,0 +1,2 @@
+Improve compiler version information in :data:`sys.version` when Python is
+built with Clang.
index 9d9c33ac2de6d43f4ac3f2523fae1bb275a75019..59c0dbf92aebf42fabf41661b8262aa89a15b60b 100644 (file)
@@ -5,15 +5,14 @@
 
 #ifndef COMPILER
 
-#ifdef __GNUC__
+// Note the __clang__ conditional has to come before the __GNUC__ one because
+// clang pretends to be GCC.
+#if defined(__clang__)
+#define COMPILER "\n[Clang " __clang_version__ "]"
+#elif defined(__GNUC__)
 #define COMPILER "\n[GCC " __VERSION__ "]"
-#endif
-
-#endif /* !COMPILER */
-
-#ifndef COMPILER
-
-#ifdef __cplusplus
+// Generic fallbacks.
+#elif defined(__cplusplus)
 #define COMPILER "[C++]"
 #else
 #define COMPILER "[C]"