[3.11] GH-155757: Set `--argv0` for wasmtime (GH-155758) (#155798)

brettcannon <[email protected]>
Newsgroups gmane.comp.python.cvs
Message-ID <[email protected]>
https://github.com/python/cpython/commit/88c2fb58b518e03fd0c4161f96fa7d7a16c693e7
commit: 88c2fb58b518e03fd0c4161f96fa7d7a16c693e7
branch: 3.11
author: Miss Islington (bot) <[email protected]>
committer: brettcannon <[email protected]>
date: 2026-08-20T12:39:12-07:00
summary:

[3.11] GH-155757: Set `--argv0` for wasmtime (GH-155758) (#155798)

[3.12] GH-155757: Set `--argv0` for wasmtime (GH-155758)
(cherry picked from commit 06ba5f48e0ebdb8cfec0f251c61fb10831b23617)

Co-authored-by: Brett Cannon <[email protected]>

files:
A Misc/NEWS.d/next/Build/2026-08-13-12-57-27.gh-issue-155757._5cg0h.rst
M Tools/wasm/wasm_build.py

diff --git a/Misc/NEWS.d/next/Build/2026-08-13-12-57-27.gh-issue-155757._5cg0h.rst b/Misc/NEWS.d/next/Build/2026-08-13-12-57-27.gh-issue-155757._5cg0h.rst
new file mode 100644
index 000000000000000..5113bc93d937015
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2026-08-13-12-57-27.gh-issue-155757._5cg0h.rst
@@ -0,0 +1,3 @@
+Set the ``--argv0`` argument to wasmtime for WASI builds so the test suite
+passes. Otherwise the calculated paths to the stdlib for frozen modules is
+incorrect.
diff --git a/Tools/wasm/wasm_build.py b/Tools/wasm/wasm_build.py
index 78c749b88038689..7061954d839d2d2 100755
--- a/Tools/wasm/wasm_build.py
+++ b/Tools/wasm/wasm_build.py
@@ -318,6 +318,7 @@ def _check_wasi():
             "wasmtime run "
             "--wasm max-wasm-stack=8388608 "
             "--wasi preview2 "
+            "--argv0 /{relbuilddir}/python.wasm "
             "--dir {srcdir}::/ "
             "--env PYTHONPATH=/{relbuilddir}/build/lib.wasi-wasm32-{version}:/Lib"
         ),

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.