From 6ab4acecf91413fccd39f78ff14775d83498dab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns=20=F0=9F=87=B5=F0=9F=87=B8?= Date: Fri, 4 Apr 2025 09:34:02 +0100 Subject: [PATCH] GH-131770: increase assumed WASI stack size to 131072 (wasi-sdk default) (#131844) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/WebAssembly/wasi-libc/blob/e9524a0980b9bb6bb92e87a41ed1055bdda5bb86/libc-top-half/musl/src/internal/pthread_impl.h#L220 Signed-off-by: Filipe LaĆ­ns --- Lib/test/test_gettext.py | 1 + Lib/test/test_syntax.py | 1 + Python/ceval.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_gettext.py b/Lib/test/test_gettext.py index 0fbd90dcb48..04d26596849 100644 --- a/Lib/test/test_gettext.py +++ b/Lib/test/test_gettext.py @@ -485,6 +485,7 @@ class PluralFormsInternalTestCase(unittest.TestCase): s = ''.join([ str(f(x)) for x in range(200) ]) eq(s, "01233333333444444444444444444444444444444444444444444444444444444444444444444444444444444444444444445553333333344444444444444444444444444444444444444444444444444444444444444444444444444444444444444444") + @support.skip_wasi_stack_overflow() def test_security(self): raises = self.assertRaises # Test for a dangerous expression diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 2c87b145254..02d10c1961e 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -2900,6 +2900,7 @@ while 1: compile(source, "", mode) @support.cpython_only + @support.skip_wasi_stack_overflow() def test_deep_invalid_rule(self): # Check that a very deep invalid rule in the PEG # parser doesn't have exponential backtracking. diff --git a/Python/ceval.c b/Python/ceval.c index 363f263ad2a..add8c2a28c7 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -364,7 +364,7 @@ _Py_EnterRecursiveCallUnchecked(PyThreadState *tstate) # define Py_C_STACK_SIZE 1600000 #elif defined(__wasi__) /* Web assembly has two stacks, so this isn't really the stack depth */ -# define Py_C_STACK_SIZE 80000 +# define Py_C_STACK_SIZE 131072 // wasi-libc DEFAULT_STACK_SIZE #elif defined(__hppa__) || defined(__powerpc64__) # define Py_C_STACK_SIZE 2000000 #else