Skip to content

Commit 7faf7e5

Browse files
authored
closes bpo-31696: don't mention GCC in sys.version when building with clang (python#3891)
1 parent ac31770 commit 7faf7e5

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Improve compiler version information in :data:`sys.version` when Python is
2+
built with Clang.

Python/getcompiler.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55

66
#ifndef COMPILER
77

8-
#ifdef __GNUC__
8+
// Note the __clang__ conditional has to come before the __GNUC__ one because
9+
// clang pretends to be GCC.
10+
#if defined(__clang__)
11+
#define COMPILER "\n[Clang " __clang_version__ "]"
12+
#elif defined(__GNUC__)
913
#define COMPILER "\n[GCC " __VERSION__ "]"
10-
#endif
11-
12-
#endif /* !COMPILER */
13-
14-
#ifndef COMPILER
15-
16-
#ifdef __cplusplus
14+
// Generic fallbacks.
15+
#elif defined(__cplusplus)
1716
#define COMPILER "[C++]"
1817
#else
1918
#define COMPILER "[C]"

0 commit comments

Comments
 (0)