Skip to content

[3.14] gh-124111: Update Windows build to use Tcl/Tk 9.0.4 (GH-150102) (GH-149477) (GH-151562) (GH-153901) - #150197

Open
zware wants to merge 5 commits into
python:3.14from
zware:backport-c62c371-3.14
Open

[3.14] gh-124111: Update Windows build to use Tcl/Tk 9.0.4 (GH-150102) (GH-149477) (GH-151562) (GH-153901)#150197
zware wants to merge 5 commits into
python:3.14from
zware:backport-c62c371-3.14

Conversation

@zware

@zware zware commented May 21, 2026

Copy link
Copy Markdown
Member

(cherry picked from commit c62c371)

Keep tests passing for Tcl prior to 9.0 (GH-150102)

(cherry picked from commit ec9ce3e)

Co-Authored-By: Steve Dower steve.dower@python.org

(cherry picked from commit c62c371)

Keep tests passing for Tcl prior to 9.0 (pythonGH-150102)

(cherry picked from commit ec9ce3e)

Co-Authored-By: Steve Dower <steve.dower@python.org>
@zware zware changed the title [3.14] gh-124111: Update Windows build to use Tcl/Tk 9.0.3 (GH-149477) (GH-150102) [3.14] gh-124111: Update Windows build to use Tcl/Tk 9.0.3 (GH-150102) (GH-149477) May 21, 2026
@zware

zware commented May 21, 2026

Copy link
Copy Markdown
Member Author

To be kept in draft until declared ready to merge by @zooba and @hugovk. I'd like it to make the next patch release but it's not critical to do so, setting 'deferred blocker' just to keep it on the radar.

@hugovk

hugovk commented Jun 3, 2026

Copy link
Copy Markdown
Member

Let's resolve #150836 first :)

zware and others added 2 commits June 24, 2026 10:40
…GH-151562)

Tcl/Tk 9 may embed the Tk script library in the Tk DLL on Windows. This embedded library is not found by Tcl by default.

Mount the loaded Tk DLL as a zipfs archive before calling Tk_Init(), so Tk can find its embedded tk_library using its existing library discovery logic.

Preserve Tk_Init()'s normal path if the library is not embedded.
@zware

zware commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

gh-150836 was resolved by GH-151562, which is now included here.

@ned-deily

Copy link
Copy Markdown
Member

As of 2026-06-26, Tcl/Tk 9.0.4 is current.

@zware

zware commented Jul 18, 2026

Copy link
Copy Markdown
Member Author

I'll start the process of getting main and 3.15 updated to that on the Windows side.

@zware zware changed the title [3.14] gh-124111: Update Windows build to use Tcl/Tk 9.0.3 (GH-150102) (GH-149477) [3.14] gh-124111: Update Windows build to use Tcl/Tk 9.0.4 (GH-150102) (GH-149477) (GH-151562) Jul 18, 2026
@zware zware changed the title [3.14] gh-124111: Update Windows build to use Tcl/Tk 9.0.4 (GH-150102) (GH-149477) (GH-151562) [3.14] gh-124111: Update Windows build to use Tcl/Tk 9.0.4 (GH-150102) (GH-149477) (GH-151562) (GH-153901) Jul 18, 2026
@bedevere-app bedevere-app Bot added the sprint label Jul 18, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Sprint Jul 18, 2026
@encukou

encukou commented Jul 28, 2026

Copy link
Copy Markdown
Member

What's the plan with 9.0.4 on Python 3.14?

@hugovk

hugovk commented Jul 28, 2026

Copy link
Copy Markdown
Member

To be kept in draft until declared ready to merge by @zooba and @hugovk. I'd like it to make the next patch release but it's not critical to do so, setting 'deferred blocker' just to keep it on the radar.

Let's resolve #150836 first :)

We've had it in 3.15 since b2. That issue was a bug in b2, fixed in b3, and b4 has since also come out, and it seems fine.

We already use Tck/Tk 9 in the macOS installer for both 3.14 and 3.15.

So I think we're ready to merge this for 3.14 as well.

@zware
zware marked this pull request as ready for review July 28, 2026 16:33
@zware
zware requested a review from sethmlarson as a code owner July 28, 2026 16:33
@zware
zware requested a review from a team as a code owner July 28, 2026 16:33

@sethmlarson sethmlarson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SBOM changes LGTM

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in Sprint Jul 29, 2026
@hugovk

hugovk commented Jul 31, 2026

Copy link
Copy Markdown
Member

Just found this from the b4 logs:

WARNING  Failed to find TCL_LIBRARY

https://dev.azure.com/Python/cpython/_build/results?buildId=172790&view=results

Under:

"Generate layouts" > "Make layouts amd64 / amd64_t / etc" > "Generate full layout"

and:

"Generate layouts" > "Make PyManager layouts amd64 / amd64_t / etc" > "Generate PyManager layout"


Claude summary:

Windows release layouts silently ship without tcl\ under Tcl/Tk 9

The problem

The Windows release pipelines in python/release-tools hardcode
TCL_LIBRARY=<tcltk_lib artifact>\tcl8 before generating package layouts.
CPython's PC/layout script checks that path is a real directory, then copies
its parent (the whole Tcl/Tk lib artifact) into the package as tcl\.

  • A Tcl 8.6 artifact contains a tcl8 directory, so this worked.
  • A Tcl 9 artifact does not (its lib holds dde1.4, registry1.3, tk9.0,
    nmake, and the embedded-library zips libtcl9.0.4.zip/libtk9.0.4.zip),
    so the check fails, the layout script logs a non-fatal
    WARNING Failed to find TCL_LIBRARY, and silently ships without tcl\.

Evidence

  • 3.15 is already affected — it has been on Tcl 9.0.4 since before b1.
    In build Release_v3.15.0b4_20260718.01
    (https://dev.azure.com/Python/cpython/_build/results?buildId=172790),
    stage "Generate layouts", the warning appears in all 15 tcltk-including
    layout jobs:

    • "Make layouts {amd64,arm64,win32}{,_t}" → step "Generate full layout"
    • "Make PyManager layouts {amd64,arm64,win32}{,_t,_test}" → step
      "Generate PyManager layout"

    Example log line ("Make PyManager layouts arm64"):

    2026-07-18T09:28:28.7088959Z WARNING  Failed to find TCL_LIBRARY
    

    The nuget/embeddable/*_embed jobs are unaffected because their layout
    presets don't include tcltk (PC/layout/support/options.py).

  • Shipped packages confirm it: python-3.15.0b4-amd64.zip has zero
    tcl/ entries, vs. 1027 in python-3.14.2-amd64.zip (Tcl 8.6, same
    pipeline). Practical impact is modest — tkinter/IDLE still work because
    Tcl 9 embeds its script libraries in the DLLs (Tkinter not installed correctly on Windows 3.15.0b2 #150836) and
    tcl90.dll/tcl9tk90.dll/libtommath.dll are all present in DLLs/
    but the optional dde and registry Tcl packages are missing
    (package require dde/registry fails), diverging from the MSI installer,
    which is unaffected (msi-steps.yml passes the artifact root as
    TclTkLibraryDir and tcltk.wixproj harvests **\*).

  • 3.14 will hit this too once this PR (the Tcl/Tk 9.0.4
    backport of gh-124111) merges and a release is cut. The tcltk build
    pipeline (tcltk-build.yml) was already updated for Tcl 9 in
    release-tools#378; only the layout stages were missed.

The fix

In windows-release/stage-layout-full.yml, stage-layout-msix.yml, and
stage-layout-pymanager.yml, the "Update TCL_LIBRARY" step now picks
whichever tcl*/tk* directory actually exists in the artifact and fails
the build loudly
if none is found, so this can never silently regress again:

# PC\layout copies the *parent* of TCL_LIBRARY into the layout, so it only
# needs to name a directory that exists inside the artifact: tcl8 for
# Tcl 8.6, tk9.0 for Tcl 9 (which embeds its scripts in the DLL).
$tcl = Get-ChildItem "$(Pipeline.Workspace)\$(TclLibrary)" -Directory |
    Where-Object { $_.Name -match '^t(cl|k)\d' } | Select-Object -First 1
if (-not $tcl) {
    Write-Host "##[error]No Tcl/Tk library directory found in $(Pipeline.Workspace)\$(TclLibrary)"
    exit 1
}
Write-Host "##vso[task.setvariable variable=TCL_LIBRARY]$($tcl.FullName)"

Verified selection: tcl8 for an 8.6 artifact, tk9.0 for 9.0 — either
works since only the parent directory is used.

Also removed two per-step env: TCL_LIBRARY: $(TclLibrary) overrides in the
msix stage — a pre-existing bug that clobbered the correct path with the
artifact name (e.g. tcltk_lib_amd64) for the APPX layout steps.

@hugovk

hugovk commented Jul 31, 2026

Copy link
Copy Markdown
Member

Possible fix at python/release-tools#424.

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

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

7 participants