From 9b69a55be32fa85da5a08a519ebed6aa3b31ec3a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 19 Nov 2025 12:03:30 -0600 Subject: [PATCH 1/5] gh-141172: Update to wasi-sdk-29 (GH-141684) This commit updates CI and configuration from wasi-sdk-25 to wasi-sdk-29 which was released recently. This notably includes stubs for pthreads which all return errors, so some adjustment in logic is necessary to retain knowledge that WASI cannot yet spawn threads for example. This additionally increases the wasm stack allowance to 32MiB from 16MiB to accomodate the `test_recursive_pickle` test in the `test_functools.py` file. It looks like the Clang/LLVM update that happened in wasi-sdk-29 relative to wasi-sdk-25 is likely the cause of this where presumably functions have more locals than before and/or a slightly adjusted stack space requirement which overflows the stack. --- .github/workflows/reusable-wasi.yml | 2 +- Include/pyport.h | 1 + Lib/test/test_sys.py | 4 +--- .../Build/2025-11-19-09-21-17.gh-issue-141172.cYWc4x.rst | 1 + Tools/wasm/wasi/__main__.py | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2025-11-19-09-21-17.gh-issue-141172.cYWc4x.rst diff --git a/.github/workflows/reusable-wasi.yml b/.github/workflows/reusable-wasi.yml index a309ef4e7f4485..91d76fd1b5f8c5 100644 --- a/.github/workflows/reusable-wasi.yml +++ b/.github/workflows/reusable-wasi.yml @@ -13,7 +13,7 @@ jobs: timeout-minutes: 60 env: WASMTIME_VERSION: 38.0.3 - WASI_SDK_VERSION: 25 + WASI_SDK_VERSION: 29 WASI_SDK_PATH: /opt/wasi-sdk CROSS_BUILD_PYTHON: cross-build/build CROSS_BUILD_WASI: cross-build/wasm32-wasip1 diff --git a/Include/pyport.h b/Include/pyport.h index b250f9e308f2dd..97c0e195d19808 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -504,6 +504,7 @@ extern "C" { * Thread support is stubbed and any attempt to create a new thread fails. */ #if (!defined(HAVE_PTHREAD_STUBS) && \ + !defined(__wasi__) && \ (!defined(__EMSCRIPTEN__) || defined(__EMSCRIPTEN_PTHREADS__))) # define Py_CAN_START_THREADS 1 #endif diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 2f169c1165df05..2e87e38fe5dfdc 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -730,14 +730,12 @@ def test_thread_info(self): self.assertEqual(len(info), 3) self.assertIn(info.name, ('nt', 'pthread', 'pthread-stubs', 'solaris', None)) self.assertIn(info.lock, ('pymutex', None)) - if sys.platform.startswith(("linux", "android", "freebsd")): + if sys.platform.startswith(("linux", "android", "freebsd", "wasi")): self.assertEqual(info.name, "pthread") elif sys.platform == "win32": self.assertEqual(info.name, "nt") elif sys.platform == "emscripten": self.assertIn(info.name, {"pthread", "pthread-stubs"}) - elif sys.platform == "wasi": - self.assertEqual(info.name, "pthread-stubs") def test_abi_info(self): info = sys.abi_info diff --git a/Misc/NEWS.d/next/Build/2025-11-19-09-21-17.gh-issue-141172.cYWc4x.rst b/Misc/NEWS.d/next/Build/2025-11-19-09-21-17.gh-issue-141172.cYWc4x.rst new file mode 100644 index 00000000000000..7cade1ebd414e3 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-11-19-09-21-17.gh-issue-141172.cYWc4x.rst @@ -0,0 +1 @@ +Update to WASI SDK 29. diff --git a/Tools/wasm/wasi/__main__.py b/Tools/wasm/wasi/__main__.py index bb5ce30c5d8b4f..59ffd436258185 100644 --- a/Tools/wasm/wasi/__main__.py +++ b/Tools/wasm/wasi/__main__.py @@ -31,7 +31,7 @@ b"# Required to statically build extension modules." ) -WASI_SDK_VERSION = 25 +WASI_SDK_VERSION = 29 WASMTIME_VAR_NAME = "WASMTIME" WASMTIME_HOST_RUNNER_VAR = f"{{{WASMTIME_VAR_NAME}}}" @@ -419,8 +419,8 @@ def main(): f"{WASMTIME_HOST_RUNNER_VAR} run " # Make sure the stack size will work for a pydebug # build. - # Use 16 MiB stack. - "--wasm max-wasm-stack=16777216 " + # Use 32 MiB stack. + "--wasm max-wasm-stack=33554432 " # Enable thread support; causes use of preview1. # "--wasm threads=y --wasi threads=y " # Map the checkout to / to load the stdlib from /Lib. From 01713b434233247bc54b04512ba5bc15ab364768 Mon Sep 17 00:00:00 2001 From: Luciano Ramalho Date: Wed, 19 Nov 2025 15:22:27 -0300 Subject: [PATCH 2/5] gh-141721: Improve docstring for LastUpdatedOrderedDict example (gh141724) --- Doc/library/collections.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index 9a8108d882e02f..4e0db485e068a8 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -1209,7 +1209,7 @@ If a new entry overwrites an existing entry, the original insertion position is changed and moved to the end:: class LastUpdatedOrderedDict(OrderedDict): - 'Store items in the order the keys were last added' + 'Store items in the order that the keys were last updated.' def __setitem__(self, key, value): super().__setitem__(key, value) From 3149d64c93f02217eb01c0fd82c26a685b5281c1 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Wed, 19 Nov 2025 18:32:18 +0000 Subject: [PATCH 3/5] gh-141004: Document `Py_LOCAL` and `Py_LOCAL_INLINE` (GH-141725) --- Doc/c-api/intro.rst | 11 +++++++++++ Doc/whatsnew/2.5.rst | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst index bace21b7981091..c39e006f059d30 100644 --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -171,6 +171,17 @@ complete listing. Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the command line (see :c:member:`PyConfig.use_environment`). +.. c:macro:: Py_LOCAL(type) + + Declare a function returning the specified *type* using a fast-calling + qualifier for functions that are local to the current file. + Semantically, this is equivalent to ``static type``. + +.. c:macro:: Py_LOCAL_INLINE(type) + + Equivalent to :c:macro:`Py_LOCAL` but additionally requests the function + be inlined. + .. c:macro:: Py_MAX(x, y) Return the maximum value between ``x`` and ``y``. diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst index 3430ac8668e280..e195d9d462dda9 100644 --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -2169,9 +2169,9 @@ Changes to Python's build process and to the C API include: * Two new macros can be used to indicate C functions that are local to the current file so that a faster calling convention can be used. - ``Py_LOCAL(type)`` declares the function as returning a value of the + :c:macro:`Py_LOCAL` declares the function as returning a value of the specified *type* and uses a fast-calling qualifier. - ``Py_LOCAL_INLINE(type)`` does the same thing and also requests the + :c:macro:`Py_LOCAL_INLINE` does the same thing and also requests the function be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined before :file:`python.h` is included, a set of more aggressive optimizations are enabled for the module; you should benchmark the results to find out if these From fbc31d14ffaae1f252865db52fc7f5f6311e7b1a Mon Sep 17 00:00:00 2001 From: Ayappan Perumal Date: Thu, 20 Nov 2025 01:42:10 +0530 Subject: [PATCH 4/5] Move the NEWS entry for gh-141659 to the correct section (GH-141744) --- .../2025-11-17-08-16-30.gh-issue-141659.QNi9Aj.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Misc/NEWS.d/next/{Core_and_Builtins => Library}/2025-11-17-08-16-30.gh-issue-141659.QNi9Aj.rst (100%) diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-11-17-08-16-30.gh-issue-141659.QNi9Aj.rst b/Misc/NEWS.d/next/Library/2025-11-17-08-16-30.gh-issue-141659.QNi9Aj.rst similarity index 100% rename from Misc/NEWS.d/next/Core_and_Builtins/2025-11-17-08-16-30.gh-issue-141659.QNi9Aj.rst rename to Misc/NEWS.d/next/Library/2025-11-17-08-16-30.gh-issue-141659.QNi9Aj.rst From b4344f7020f066e83a113e0d4f9343cec4e56a1e Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 19 Nov 2025 12:30:01 -0800 Subject: [PATCH 5/5] Remove GvR from '_stdauthor' in Doc/conf.py (#141765) Co-authored-by: Guido van Rossum --- Doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/conf.py b/Doc/conf.py index 0f1412d1007dc2..a4275835059efa 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -361,7 +361,7 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). -_stdauthor = 'Guido van Rossum and the Python development team' +_stdauthor = 'The Python development team' latex_documents = [ ('c-api/index', 'c-api.tex', 'The Python/C API', _stdauthor, 'manual'), (