GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix clang-cl version in sys.version on Windows · Issue #157368 · python/cpython

Fix clang-cl version in sys.version on Windows #157368

New issue
Copy link
New issue
Copy link
Closed
Closed
Fix clang-cl version in sys.version on Windows#157368
Copy link
Assignees
chris-eibl
Labels
OS-unsupportedOS-windowsinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@chris-eibl
chris-eibl
opened on Sep 12, 2026
Issue body actions

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

cpython/PC/pyconfig.h

Line 161 in 7bfa97f

#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

cpython/Python/getversion.c

Lines 17 to 23 in 7bfa97f

#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

  • gh-157368: Fix clang-cl version in sys.version on Windows #157369
  • [3.15] gh-157368: Fix clang-cl version in sys.version on Windows (GH-157369) #157565
  • [3.14] gh-157368: Fix clang-cl version in sys.version on Windows (GH-157369) #157569
  • [3.13] gh-157368: Fix clang-cl version in sys.version on Windows (GH-157369) #157606
Reacted by Stan Ulbrych

Activity

  1. chris-eibl
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    OS-windows
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    OS-unsupported
    on Sep 12, 2026
  2. github-project-automation
    added this to Unsupported platformson Sep 12, 2026
  3. StanFromIreland
    removed
    OS-unsupported
    on Sep 12, 2026
  4. StanFromIreland commented on Sep 12, 2026

    @StanFromIreland
    StanFromIreland
    on Sep 12, 2026
    Member
    More actions

    JYFI, if you're planning to fix this yourself I suggest you assign yourself, otherwise agents have a habit of sending PRs for such things...

    Reacted by Chris Eibl
  5. chris-eibl
    self-assigned this
    on Sep 12, 2026
  6. chris-eibl commented on Sep 12, 2026

    @chris-eibl
    chris-eibl
    on Sep 12, 2026
    MemberAuthor
    More actions

    Hope I was faster :)

    Reacted by Stan Ulbrych and An Long
  7. chris-eibl
    added
    OS-unsupported
    on Sep 12, 2026
  8. chris-eibl commented on Sep 12, 2026

    @chris-eibl
    chris-eibl
    on Sep 12, 2026
    MemberAuthor
    More actions

    Adding OS-unsupported again since @encukou ask me to do so for clang-cl issues in #154210 (comment).

  9. chris-eibl
    moved this to In Progress in Unsupported platformson Sep 12, 2026
  10. StanFromIreland commented on Sep 12, 2026

    @StanFromIreland
    StanFromIreland
    on Sep 12, 2026
    Member
    More actions

    Aargh, sorry, that makes sense!

  11. zware
    added a commit that references this issue on Sep 13, 2026

    gh-157368: Fix clang-cl version in sys.version on Windows (GH-157369)

    0ba7be9
  12. johnslavik
    added a commit that references this issue on Sep 14, 2026

    pythongh-157368: Fix clang-cl version in sys.version on Windows (pyth…

    6bb1710
  13. zware
    added a commit that references this issue on Sep 15, 2026

    [3.14] gh-157368: Fix clang-cl version in sys.version on Windows (GH-…

    d6375c3
  14. zware commented on Sep 15, 2026

    @zware
    zware
    on Sep 15, 2026
    Member
    More actions

    Done other than 3.15, which I think will probably wait for 3.15.0 final.

    Reacted by Chris Eibl
    Reacted by Chris Eibl
  15. zware
    closed this as completedon Sep 15, 2026
  16. github-project-automation
    moved this from In Progress to Done in Unsupported platformson Sep 15, 2026
  17. hugovk
    added a commit that references this issue on Sep 17, 2026

    [3.15] gh-157368: Fix clang-cl version in sys.version on Windows (GH-…

    5a1180c
  18. vstinner commented on Oct 2, 2026

    @vstinner
    vstinner
    on Oct 2, 2026
    Member
    More actions

    I wrote PR gh-158608 to allocate Py_GetVersion() on the heap memory, to no longer have fixed limits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @chris-eibl
    chris-eibl

Labels

OS-unsupportedOS-windowsinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

  • Unsupported platforms
    Status
    Done
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.