]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-114013: fix setting `HOSTRUNNER` for `Tools/wasm/wasi.py` (GH-114097)
authorBrett Cannon <brett@python.org>
Tue, 16 Jan 2024 19:36:41 +0000 (11:36 -0800)
committerGitHub <noreply@github.com>
Tue, 16 Jan 2024 19:36:41 +0000 (11:36 -0800)
Also fix tests found failing under a pydebug build of WASI thanks to `make test` working due to this change.

Lib/test/test_isinstance.py
Lib/test/test_richcmp.py
Lib/test/test_typing.py
Lib/test/test_userdict.py
Lib/test/test_userlist.py
Lib/test/test_xml_etree.py
Misc/NEWS.d/next/Build/2024-01-15-16-58-43.gh-issue-114013.FoSeQf.rst [new file with mode: 0644]
Tools/wasm/wasi.py

index 791981b878b1f25a2f0787ec92ae9133f796a8f6..7f759fb3317146eb62c78f234bfcc3e7a0895742 100644 (file)
@@ -310,7 +310,7 @@ class TestIsInstanceIsSubclass(unittest.TestCase):
             @property
             def __bases__(self):
                 return self.__bases__
-        with support.infinite_recursion():
+        with support.infinite_recursion(25):
             self.assertRaises(RecursionError, issubclass, X(), int)
             self.assertRaises(RecursionError, issubclass, int, X())
             self.assertRaises(RecursionError, isinstance, 1, X())
index 6fb31c80d7e6707ab19d196b54cce6691ac48eb7..5f449cdc05c6bae1afdae79a5edc8b00f7051479 100644 (file)
@@ -221,7 +221,7 @@ class MiscTest(unittest.TestCase):
             self.assertRaises(Exc, func, Bad())
 
     @support.no_tracing
-    @support.infinite_recursion()
+    @support.infinite_recursion(25)
     def test_recursion(self):
         # Check that comparison for recursive objects fails gracefully
         from collections import UserList
index 8edab0cd6e34db13d168ac43378f85cbd5a4849d..b684af4f33ed71d4bf7f51684bf1f217feea8d4c 100644 (file)
@@ -5684,7 +5684,7 @@ class ForwardRefTests(BaseTestCase):
         def cmp(o1, o2):
             return o1 == o2
 
-        with infinite_recursion():
+        with infinite_recursion(25):
             r1 = namespace1()
             r2 = namespace2()
             self.assertIsNot(r1, r2)
index 9a03f2d04ce970a1866024fefa1e4cbe2e6c2896..61e79f553e8ec9178058bd1d74b74642baae8dc2 100644 (file)
@@ -215,7 +215,7 @@ class UserDictTest(mapping_tests.TestHashMappingProtocol):
 
     # Decorate existing test with recursion limit, because
     # the test is for C structure, but `UserDict` is a Python structure.
-    test_repr_deep = support.infinite_recursion()(
+    test_repr_deep = support.infinite_recursion(25)(
         mapping_tests.TestHashMappingProtocol.test_repr_deep,
     )
 
index 76d253753528b00070418b1ea097de644b4d7268..312702c8e398b9bdb072bf4e60d3aa2f8193868a 100644 (file)
@@ -69,7 +69,7 @@ class UserListTest(list_tests.CommonTest):
 
     # Decorate existing test with recursion limit, because
     # the test is for C structure, but `UserList` is a Python structure.
-    test_repr_deep = support.infinite_recursion()(
+    test_repr_deep = support.infinite_recursion(25)(
         list_tests.CommonTest.test_repr_deep,
     )
 
index 80ee064896f59a363f29bf503ae8435333b84b0b..b9e7937b0bbc00a5163632269f3cc9e2e9d90272 100644 (file)
@@ -2535,7 +2535,7 @@ class BadElementTest(ElementTestCase, unittest.TestCase):
         e.extend([ET.Element('bar')])
         self.assertRaises(ValueError, e.remove, X('baz'))
 
-    @support.infinite_recursion()
+    @support.infinite_recursion(25)
     def test_recursive_repr(self):
         # Issue #25455
         e = ET.Element('foo')
diff --git a/Misc/NEWS.d/next/Build/2024-01-15-16-58-43.gh-issue-114013.FoSeQf.rst b/Misc/NEWS.d/next/Build/2024-01-15-16-58-43.gh-issue-114013.FoSeQf.rst
new file mode 100644 (file)
index 0000000..1150502
--- /dev/null
@@ -0,0 +1,4 @@
+Fix ``Tools/wasm/wasi.py`` to not include the path to ``python.wasm`` as
+part of ``HOSTRUNNER``. The environment variable is meant to specify how to
+run the WASI host only, having ``python.wasm`` and relevant flags appended
+to the ``HOSTRUNNER``. This fixes ``make test`` work.
index 34c0e9375e24c80c8a90355af00458586c8b053b..36bc70ffd9db7b0edaceef3f4b6a209a2593434a 100644 (file)
@@ -233,9 +233,10 @@ def configure_wasi_python(context, working_dir):
          env=updated_env(env_additions | wasi_sdk_env(context)),
          quiet=context.quiet)
 
+    python_wasm = working_dir / "python.wasm"
     exec_script = working_dir / "python.sh"
     with exec_script.open("w", encoding="utf-8") as file:
-        file.write(f'#!/bin/sh\nexec {host_runner} "$@"\n')
+        file.write(f'#!/bin/sh\nexec {host_runner} {python_wasm} "$@"\n')
     exec_script.chmod(0o755)
     print(f"🏃‍♀️ Created {exec_script} ... ")
     sys.stdout.flush()
@@ -272,9 +273,7 @@ def main():
                         # Map the checkout to / to load the stdlib from /Lib.
                         "--dir {HOST_DIR}::{GUEST_DIR} "
                         # Set PYTHONPATH to the sysconfig data.
-                        "--env {ENV_VAR_NAME}={ENV_VAR_VALUE} "
-                        # Path to the WASM binary.
-                        "{PYTHON_WASM}")
+                        "--env {ENV_VAR_NAME}={ENV_VAR_VALUE}")
 
     parser = argparse.ArgumentParser()
     subcommands = parser.add_subparsers(dest="subcommand")
@@ -310,8 +309,8 @@ def main():
                                      "$WASI_SDK_PATH or /opt/wasi-sdk")
         subcommand.add_argument("--host-runner", action="store",
                         default=default_host_runner, dest="host_runner",
-                        help="Command template for running the WebAssembly "
-                             "code (default meant for wasmtime 14 or newer: "
+                        help="Command template for running the WASI host "
+                             "(default designed for wasmtime 14 or newer: "
                                 f"`{default_host_runner}`)")
 
     context = parser.parse_args()