Skip to content

Commit c3884ce

Browse files
committed
Get a few more test passing on WASI
1 parent 6b48afe commit c3884ce

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

Include/pythonrun.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ PyAPI_DATA(int) (*PyOS_InputHook)(void);
2929
# define PYOS_STACK_MARGIN 4096
3030
#elif defined(Py_DEBUG) && defined(WIN32)
3131
# define PYOS_STACK_MARGIN 3072
32+
#elif defined(__wasi__)
33+
/* Web assembly has two stacks, so this isn't really a size */
34+
# define PYOS_STACK_MARGIN 500
3235
#else
3336
# define PYOS_STACK_MARGIN 2048
3437
#endif

Lib/test/test_class.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import unittest
44
from test import support
5-
from test.support import cpython_only, import_helper, script_helper, skip_emscripten_stack_overflow
5+
from test.support import cpython_only, import_helper, script_helper
66

77
testmeths = [
88

@@ -556,7 +556,8 @@ class Custom:
556556
self.assertFalse(hasattr(o, "__call__"))
557557
self.assertFalse(hasattr(c, "__call__"))
558558

559-
@skip_emscripten_stack_overflow()
559+
@support.skip_emscripten_stack_overflow()
560+
@support.skip_wasi_stack_overflow()
560561
def testSFBug532646(self):
561562
# Test for SF bug 532646
562563

Lib/test/test_dynamic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def test_eval_gives_lambda_custom_globals(self):
134134

135135
self.assertEqual(foo(), 7)
136136

137-
@unittest.skipIf(is_wasi and Py_DEBUG, "requires too much stack")
137+
@unittest.skipIf(is_wasi, "requires too much stack")
138138
def test_load_global_specialization_failure_keeps_oparg(self):
139139
# https://github.com/python/cpython/issues/91625
140140
class MyGlobals(dict):

Lib/test/test_patma.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3498,6 +3498,7 @@ def f(command): # 0
34983498
self.assertListEqual(self._trace(f, 1), [1, 2, 3])
34993499
self.assertListEqual(self._trace(f, 0), [1, 2, 5, 6])
35003500

3501+
@support.skip_wasi_stack_overflow()
35013502
def test_parser_deeply_nested_patterns(self):
35023503
# Deeply nested patterns can cause exponential backtracking when parsing.
35033504
# See gh-93671 for more information.

Python/ceval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ _Py_EnterRecursiveCallUnchecked(PyThreadState *tstate)
338338
# define Py_C_STACK_SIZE 1600000
339339
#elif defined(__wasi__)
340340
/* Web assembly has two stacks, so this isn't really the stack depth */
341-
# define Py_C_STACK_SIZE 100000
341+
# define Py_C_STACK_SIZE 80000
342342
#elif defined(__hppa__) || defined(__powerpc64__)
343343
# define Py_C_STACK_SIZE 2000000
344344
#else

0 commit comments

Comments
 (0)