Bug report
Bug description:
Since version 22, clang-cl on Windows includes the repo url and commit hash in __clang_version__ like
22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
versus just 21.1.4. before.
This results in sys.version being truncated
__clang_version__ is used in
|
#define _Py_COMPILER ("[Clang " __clang_version__ "] 64 bit (AMD64) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]") |
exposed via getcompiler.c and then truncated in
|
#ifdef Py_GIL_DISABLED |
|
const char *buildinfo_format = "%.80s free-threading build (%.80s) %.80s"; |
|
#else |
|
const char *buildinfo_format = "%.80s (%.80s) %.80s"; |
|
#endif |
|
PyOS_snprintf(version, sizeof(version), buildinfo_format, |
|
PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler()); |
3.16.0a0 (heads/main:7bfa97f4dc, Sep 12 2026, 16:30:16) [Clang 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb45022 on win32
versus
3.16.0a0 (heads/main:7bfa97f4dc, Sep 12 2026, 16:32:39) [Clang 21.1.4 ] 64 bit (AMD64) with MSC v.1951 CRT] on win32
A lot of code depends on being able to parse the now missing 64 bit (AMD64) part (#145410, #154200, #154199, ...). Let's restore the old behaviour and fix the stray ] as well:
3.16.0a0 (heads/fix_clang_version:e1b196dfab, Sep 12 2026, 16:28:42) [Clang 22.1.3 64 bit (AMD64) with MSC v.1951 CRT] on win32
This also fixes the failing test_single_line_statement of @zware's AMD64 Windows Server 2025 Clang 3.x buildbot (and would also fix all the failing tests of the 3.14 and 3.15 Windows clang buildbots).
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs
Bug report
Bug description:
Since version 22, clang-cl on Windows includes the repo url and commit hash in
__clang_version__likeversus just
21.1.4. before.This results in sys.version being truncated
__clang_version__is used incpython/PC/pyconfig.h
Line 161 in 7bfa97f
exposed via getcompiler.c and then truncated in
cpython/Python/getversion.c
Lines 17 to 23 in 7bfa97f
versus
A lot of code depends on being able to parse the now missing
64 bit (AMD64)part (#145410, #154200, #154199, ...). Let's restore the old behaviour and fix the stray]as well:This also fixes the failing
test_single_line_statementof @zware's AMD64 Windows Server 2025 Clang 3.x buildbot (and would also fix all the failing tests of the 3.14 and 3.15 Windows clang buildbots).CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs