Title: Fix clang-cl version in sys.version on Windows · Issue #157368 · python/cpython · GitHub
Open Graph Title: Fix clang-cl version in sys.version on Windows · Issue #157368 · python/cpython
X Title: Fix clang-cl version in sys.version on Windows · Issue #157368 · python/cpython
Description: 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. ...
Open Graph Description: 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 e9846648fd6183ee6d8cbd...
X Description: 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 e9846648fd6183ee6d8cbd...
Opengraph URL: https://github.com/python/cpython/issues/157368
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fix clang-cl version in sys.version on Windows","articleBody":"# Bug report\n\n### Bug description:\n\nSince version 22, clang-cl on Windows includes the repo url and commit hash in `__clang_version__` like\n```\n22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)\n```\nversus just `21.1.4`. before.\n\u003cdetails>\u003csummary>This results in sys.version being truncated\u003c/summary>\n\u003cp>\n\n`__clang_version__` is used in\nhttps://github.com/python/cpython/blob/7bfa97f4dca58ab45def2ca0a1e8088997a4fa0b/PC/pyconfig.h#L161\nexposed via [getcompiler.c](https://github.com/python/cpython/blob/main/Python/getcompiler.c) and then truncated in\nhttps://github.com/python/cpython/blob/7bfa97f4dca58ab45def2ca0a1e8088997a4fa0b/Python/getversion.c#L17-L23\n\u003c/p>\n\n\u003c/details> \n\n```\n3.16.0a0 (heads/main:7bfa97f4dc, Sep 12 2026, 16:30:16) [Clang 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb45022 on win32\n```\nversus\n```\n3.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\n```\n\nA lot of code depends on being able to parse the now missing `64 bit (AMD64)` part (https://github.com/python/cpython/issues/145410, https://github.com/python/cpython/issues/154200, https://github.com/python/cpython/issues/154199, ...). Let's restore the old behaviour and fix the stray ` ]` as well:\n\n```\n3.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\n```\n\nThis also fixes the failing `test_single_line_statement` of @zware's [AMD64 Windows Server 2025 Clang 3.x](https://buildbot.python.org/?#/builders/2261/builds/344) buildbot (and would also fix all the failing tests of the [3.14](https://buildbot.python.org/?#/builders/2272/builds/163) and [3.15](https://buildbot.python.org/?#/builders/2258/builds/103) Windows clang buildbots).\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nWindows\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-157369\n* gh-157565\n* gh-157569\n* gh-157606\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/chris-eibl","@type":"Person","name":"chris-eibl"},"datePublished":"2026-09-12T16:57:43Z","url":"https://github.com/python/cpython/issues/157368"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6e3d1a5a-b677-f604-337f-8bcb623f807c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C28E:213839:3B7950B:4BF35AE:6B01F9EF |
| html-safe-nonce | ee27d436a2798ce450f856a6adc886696cb11f5292f6f8171b095ee09098ed27 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjhFOjIxMzgzOTozQjc5NTBCOjRCRjM1QUU6NkIwMUY5RUYiLCJ2aXNpdG9yX2lkIjoiNDAzNzIwMTY0NDM2NTE1MDcwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 42a29e7473fbef63fa8e9add2b718d712d23cfa12343f47e9b9600b2a026fc68 |
| hovercard-subject-tag | issue:5434748871 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/157368/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8ae13bc48bf1d14aa1aa4aacf1517e33033070d6264a94cdac7604c5d978f72a/python/cpython/issues/157368 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8ae13bc48bf1d14aa1aa4aacf1517e33033070d6264a94cdac7604c5d978f72a/python/cpython/issues/157368 |
| og:image:alt | 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 e9846648fd6183ee6d8cbd... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | chris-eibl |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width