From 109d274bf4a2f490a2f4c61e6da12bd749667854 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Fri, 12 Jun 2026 16:20:41 -0700 Subject: [PATCH] gh-145177: Bump emscripten to 6.0.0 Before Emscripten 4.0.19, there was a bug in the dynamic loader that caused any dynamic library that links libffi to fail to load. _ctypes_test.so unnecessarily links libffi so it would fail to load and tests that needed it were skipped. There are two test failures behind that: one involving stack overflows which we have to skip as usual, and one that assumes that the abi for a function that takes a single struct with two doubles is the same as the abi for a function that takes two double arguments. This is not true in webassembly so we skip the test. --- Lib/test/test_ctypes/test_as_parameter.py | 3 ++- Lib/test/test_ctypes/test_structures.py | 9 +++++++++ Platforms/emscripten/config.toml | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_ctypes/test_as_parameter.py b/Lib/test/test_ctypes/test_as_parameter.py index 2da1acfcf2989ee..c9d728e9ae2f9cb 100644 --- a/Lib/test/test_ctypes/test_as_parameter.py +++ b/Lib/test/test_ctypes/test_as_parameter.py @@ -5,7 +5,7 @@ c_short, c_int, c_long, c_longlong, c_byte, c_wchar, c_float, c_double, ArgumentError) -from test.support import import_helper, skip_if_sanitizer +from test.support import import_helper, skip_if_sanitizer, skip_emscripten_stack_overflow _ctypes_test = import_helper.import_module("_ctypes_test") @@ -193,6 +193,7 @@ class S8I(Structure): (9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9)) @skip_if_sanitizer('requires deep stack', thread=True) + @skip_emscripten_stack_overflow() def test_recursive_as_param(self): class A: pass diff --git a/Lib/test/test_ctypes/test_structures.py b/Lib/test/test_ctypes/test_structures.py index 92d4851d739d47b..e9a1d455a2d689e 100644 --- a/Lib/test/test_ctypes/test_structures.py +++ b/Lib/test/test_ctypes/test_structures.py @@ -302,6 +302,15 @@ class X(Structure): def _test_issue18060(self, Vector): # Regression tests for gh-62260 + # This test passes a struct of two doubles by value to the atan2(), + # whose actual C signature is atan2(double, double), so it only works on + # platforms where the abi of a function that takes a struct with two + # doubles matches the abi of a function that takes two doubles. The + # wasm32 ABI does not satisfy this condition and the test breaks. + if support.is_wasm32: + self.skipTest( + "wasm ABI is incompatible with test expectations") + # The call to atan2() should succeed if the # class fields were correctly cloned in the # subclasses. Otherwise, it will segfault. diff --git a/Platforms/emscripten/config.toml b/Platforms/emscripten/config.toml index 401e9396ddbb009..389d2ea66ce948e 100644 --- a/Platforms/emscripten/config.toml +++ b/Platforms/emscripten/config.toml @@ -1,7 +1,7 @@ # Any data that can vary between Python versions is to be kept in this file. # This allows for blanket copying of the Emscripten build code between supported # Python versions. -emscripten-version = "4.0.19" +emscripten-version = "6.0.0" node-version = "24" test-args = [ "-m", "test",