Skip to content

Commit 6f1b85c

Browse files
committed
gh-145177: Bump emscripten to 5.0.4
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. There is another regression in Emscripten 5.0.5 which breaks a couple tests in test_secrets and test_random, so leave updating past that to a followup.
1 parent f4f1020 commit 6f1b85c

4 files changed

Lines changed: 26 additions & 3 deletions

File tree

Lib/test/test_ctypes/test_as_parameter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
c_short, c_int, c_long, c_longlong,
66
c_byte, c_wchar, c_float, c_double,
77
ArgumentError)
8-
from test.support import import_helper, skip_if_sanitizer
8+
from test.support import import_helper, skip_if_sanitizer, skip_emscripten_stack_overflow
99
_ctypes_test = import_helper.import_module("_ctypes_test")
1010

1111

@@ -193,6 +193,7 @@ class S8I(Structure):
193193
(9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9))
194194

195195
@skip_if_sanitizer('requires deep stack', thread=True)
196+
@skip_emscripten_stack_overflow()
196197
def test_recursive_as_param(self):
197198
class A:
198199
pass

Lib/test/test_ctypes/test_structures.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,15 @@ class X(Structure):
302302
def _test_issue18060(self, Vector):
303303
# Regression tests for gh-62260
304304

305+
# This test passes a struct of two doubles by value to the atan2(),
306+
# whose actual C signature is atan2(double, double), so it only works on
307+
# platforms where the abi of a function that takes a struct with two
308+
# doubles matches the abi of a function that takes two doubles. The
309+
# wasm32 ABI does not satisfy this condition and the test breaks.
310+
if support.is_wasm32:
311+
self.skipTest(
312+
"wasm ABI is incompatible with test expectations")
313+
305314
# The call to atan2() should succeed if the
306315
# class fields were correctly cloned in the
307316
# subclasses. Otherwise, it will segfault.

Lib/test/test_platform.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,20 @@ def test_ios_ver(self):
534534

535535
def test_libc_ver(self):
536536
if support.is_emscripten:
537-
assert platform.libc_ver() == ("emscripten", "4.0.19")
537+
import tomllib
538+
from pathlib import Path
539+
540+
# Get expected emscripten version from emscripten config
541+
config_path = (
542+
Path(__file__).parents[2] / "Platforms/emscripten/config.toml"
543+
)
544+
with open(config_path, "rb") as fp:
545+
emscripten_version = tomllib.load(fp)["emscripten-version"]
546+
547+
self.assertEqual(
548+
platform.libc_ver(), ("emscripten", emscripten_version)
549+
)
550+
538551
return
539552
# check that libc_ver(executable) doesn't raise an exception
540553
if os.path.isdir(sys.executable) and \

Platforms/emscripten/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Any data that can vary between Python versions is to be kept in this file.
22
# This allows for blanket copying of the Emscripten build code between supported
33
# Python versions.
4-
emscripten-version = "4.0.19"
4+
emscripten-version = "5.0.4"
55
node-version = "24"
66
test-args = [
77
"-m", "test",

0 commit comments

Comments
 (0)