Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/scripts/ft-wasm/build-wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# Environment:
# FT_WORK scratch directory (default .tmp/ft-wasm)
# FT_OUT receives the archive the workflow uploads (default .tmp/ft-wasm-out)
# FT_WASM_EMSDK_VERSION Emscripten to install; empty = the version CPython itself pins
# (Platforms/emscripten/config.toml, 4.0.19 in 3.15.0)
# FT_WASM_EMSDK_VERSION Emscripten to install; empty = 5.0.3 (DEFAULT_EMSDK_VERSION below),
# not the 4.0.19 CPython 3.15.0 pins in Platforms/emscripten/config.toml
# FT_WASM_TRAMPOLINE_PATCH apply (default) | skip; see patch_trampoline below
#
# Needs: a C toolchain for the native build Python, git, curl, node on PATH
Expand All @@ -16,8 +16,8 @@
# This is a separate script, not a mode of python-multiplatform/scripts/wasm/build-cpython.sh:
# that script is pinned to CPython 3.14.2 / Emscripten 5.0.3 / pyemscripten_2026_0, clones a
# pinned git commit, writes into .caches/ and stages the runtime the wasmJs suite runs against.
# This job builds a different CPython (3.15.0 tarball) with a different Emscripten and must not
# touch that runtime. The flags below are the #175 investigation's proposal, not a decision.
# This job builds a different CPython (3.15.0 tarball) and must not touch that runtime. Both use
# Emscripten 5.0.3. The flags below are the #175 investigation's proposal, not a decision.
set -euo pipefail
here="$(cd "$(dirname "$0")" && pwd)"

Expand Down Expand Up @@ -57,7 +57,12 @@ cd "$src"
# activated environment ("Build will use EMSDK from current environment").
pinned="$(sed -n 's/^emscripten-version = "\(.*\)"$/\1/p' Platforms/emscripten/config.toml)"
[ -n "$pinned" ] || die "no emscripten-version in Platforms/emscripten/config.toml"
EMSDK_VERSION="${FT_WASM_EMSDK_VERSION:-$pinned}"
# The default is 5.0.3, the version pyemscripten_2026_0 pins and build-cpython.sh uses, so PMP's
# wasm runtime and pypackpack #82's wheels share one Emscripten. Leader 2026-11-26, Decision 10 (b) b1 in the team report pmp-binder.md: "b1 approved (one Emscripten 5.0.3 for PMP wasm and pypackpack #82)".
# Evidence: build-ft-wasm run 45623531263 (5274e9e2) on 5.0.3, green: smoke OK in both layouts,
# embedding probe a to d OK. CPython's own pin is still logged, so a divergence stays visible.
DEFAULT_EMSDK_VERSION=5.0.3
EMSDK_VERSION="${FT_WASM_EMSDK_VERSION:-$DEFAULT_EMSDK_VERSION}"
log "Emscripten pinned by CPython $PY_VERSION: $pinned; using: $EMSDK_VERSION"
emsdk="$FT_WORK/emsdk"
if [ ! -x "$emsdk/emsdk" ]; then
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build-ft-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ name: Build free-threaded CPython for wasm
# add the new wasm 3.15t CI build job"). It does not touch wasm.yml or the runtime the
# wasmJs suite uses. See docs/platforms/free-threaded-wasm.md.
#
# Experiment choices (agent proposal, not decisions): Emscripten defaults to the version
# CPython itself pins (Platforms/emscripten/config.toml, 4.0.19 for 3.15.0), not the 5.0.3
# of python-multiplatform/scripts/wasm/build-cpython.sh; the compile/link flags are the
# #175 investigation's; the call trampoline is patched to fall back to its JS path under
# Emscripten defaults to 5.0.3, the version of python-multiplatform/scripts/wasm/build-cpython.sh
# and pypackpack #82 (Leader 2026-11-26, Decision 10 (b) b1 in the team report pmp-binder.md: "b1 approved (one Emscripten 5.0.3 for PMP wasm and pypackpack #82)"; evidence: run 45623531263, green on
# 5.0.3), not the 4.0.19 CPython pins in Platforms/emscripten/config.toml. Experiment choices
# (agent proposal, not decisions): the compile/link flags are the #175 investigation's; the call trampoline is patched to fall back to its JS path under
# shared memory (trampoline_patch=skip runs without it).

on:
Expand All @@ -22,7 +22,7 @@ on:
required: true
type: string
emscripten_version:
description: Emscripten to use (empty = the version CPython pins in Platforms/emscripten/config.toml)
description: Emscripten to use (empty = 5.0.3, the default in build-wasm.sh)
default: ""
required: false
type: string
Expand Down
15 changes: 8 additions & 7 deletions docs/platforms/free-threaded-wasm.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ driver has no install or package step for Emscripten, so the script assembles it

These are agent proposals from the #175 investigation, not decisions:

- **Emscripten**: the version CPython itself pins (`emscripten-version` in
`Platforms/emscripten/config.toml`, 4.0.19 for 3.15.0), not the 5.0.3 that
`build-cpython.sh` pins for `pyemscripten_2026_0`. Which version the library should use is
open. The dispatch input `emscripten_version` overrides it, so 5.0.3 can be tried without
editing the script.
- **Emscripten**: 5.0.3, the version `build-cpython.sh` pins for `pyemscripten_2026_0`, not the
4.0.19 CPython 3.15.0 pins in `Platforms/emscripten/config.toml`. Leader 2026-11-26, Decision 10 (b) b1 in the team report pmp-binder.md: "b1 approved (one Emscripten 5.0.3 for PMP wasm and pypackpack #82)". Evidence:
build-ft-wasm run 45623531263 (5274e9e2) on 5.0.3 was green: the smoke test passed in both layouts
(`proxy-to-pthread` and `embedded`, 200 upcalls, slots traverse 3201 / clear 1600 / dealloc 1602),
the embedding probe passed `a` to `d`, and `python.wasm` imports a shared memory (min 320, max 32768
pages). The dispatch input `emscripten_version` still overrides it. Earlier runs used 4.0.19.
- **Node**: 24, the version `config.toml` pins, passed as `--host-runner node`.
- **Flags**:

Expand Down Expand Up @@ -170,8 +171,8 @@ Kotlin-side memory import).

## Not verified

- The workflow has not run yet. Whether 3.15.0 configures, compiles and links with
`--disable-gil --enable-wasm-pthreads` on Emscripten 4.0.19 is unknown. The only real
- (Superseded: 3.15.0 now configures, compiles and links with `--disable-gil
--enable-wasm-pthreads` on Emscripten 4.0.19 and 5.0.3, see above.) Before the first run the only real
evidence is upstream's free-threaded build **without** pthreads (CPython gh-158997, on
`main` with Emscripten 6.0.10) and Pyodide's **GIL** build with pthreads (3.14, Emscripten
5.0.3). No project is known to have combined the two.
Expand Down
Loading