From 751d80f7a6520b3f63224b7b5a2648adf046e88e 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 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. --- Lib/test/test_platform.py | 15 ++++++++++++++- Platforms/emscripten/config.toml | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index 63c130813ec4972..3503eaefaf8e9e7 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -534,7 +534,20 @@ def test_ios_ver(self): def test_libc_ver(self): if support.is_emscripten: - assert platform.libc_ver() == ("emscripten", "4.0.19") + import tomllib + from pathlib import Path + + # Get expected emscripten version from emscripten config + config_path = ( + Path(__file__).parents[2] / "Platforms/emscripten/config.toml" + ) + with open(config_path, "rb") as fp: + emscripten_version = tomllib.load(fp)["emscripten-version"] + + self.assertEqual( + platform.libc_ver(), ("emscripten", emscripten_version) + ) + return # check that libc_ver(executable) doesn't raise an exception if os.path.isdir(sys.executable) and \ diff --git a/Platforms/emscripten/config.toml b/Platforms/emscripten/config.toml index 401e9396ddbb009..ca456a94a25a49c 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 = "5.0.4" node-version = "24" test-args = [ "-m", "test",