Removed special-casing for WASI when setting C stack depth limits. Since WASI has its own C stack checking this isn't a security risk.
Also disabled some tests that stopped passing. They all happened to have already been disabled under Emscripten.
# define PYOS_LOG2_STACK_MARGIN 12
#elif defined(Py_DEBUG) && defined(WIN32)
# define PYOS_LOG2_STACK_MARGIN 12
-#elif defined(__wasi__)
- /* Web assembly has two stacks, so this isn't really a size */
-# define PYOS_LOG2_STACK_MARGIN 9
#else
# define PYOS_LOG2_STACK_MARGIN 11
#endif
self.assertIsNot(x[0], y[0])
@support.skip_emscripten_stack_overflow()
+ @support.skip_wasi_stack_overflow()
def test_deepcopy_reflexive_list(self):
x = []
x.append(x)
self.assertIs(x, y)
@support.skip_emscripten_stack_overflow()
+ @support.skip_wasi_stack_overflow()
def test_deepcopy_reflexive_tuple(self):
x = ([],)
x[0].append(x)
self.assertIsNot(x["foo"], y["foo"])
@support.skip_emscripten_stack_overflow()
+ @support.skip_wasi_stack_overflow()
def test_deepcopy_reflexive_dict(self):
x = {}
x['foo'] = x
del C.__del__
@unittest.skipIf(support.is_emscripten, "Seems to works in Pyodide?")
+ @support.skip_wasi_stack_overflow()
def test_slots_trash(self):
# Testing slot trash...
# Deallocating deeply nested slotted trash caused stack overflows
deque.append(thing, thing)
@support.skip_emscripten_stack_overflow()
+ @support.skip_wasi_stack_overflow()
def test_repr_as_str(self):
# Issue #11603: crash or infinite loop when rebinding __str__ as
# __repr__.
import collections.abc
import types
import unittest
-from test.support import skip_emscripten_stack_overflow, exceeds_recursion_limit
+from test.support import skip_emscripten_stack_overflow, skip_wasi_stack_overflow, exceeds_recursion_limit
class TestExceptionGroupTypeHierarchy(unittest.TestCase):
def test_exception_group_types(self):
return e
@skip_emscripten_stack_overflow()
+ @skip_wasi_stack_overflow()
def test_deep_split(self):
e = self.make_deep_eg()
with self.assertRaises(RecursionError):
e.split(TypeError)
@skip_emscripten_stack_overflow()
+ @skip_wasi_stack_overflow()
def test_deep_subgroup(self):
e = self.make_deep_eg()
with self.assertRaises(RecursionError):
self.assertRaises(RecursionError, isinstance, 1, X())
@support.skip_emscripten_stack_overflow()
+ @support.skip_wasi_stack_overflow()
def test_infinite_recursion_via_bases_tuple(self):
"""Regression test for bpo-30570."""
class Failure(object):
issubclass(Failure(), int)
@support.skip_emscripten_stack_overflow()
+ @support.skip_wasi_stack_overflow()
def test_infinite_cycle_in_bases(self):
"""Regression test for bpo-30570."""
class X:
@support.skip_emscripten_stack_overflow()
+ @support.skip_wasi_stack_overflow()
def test_highly_nested_objects_decoding(self):
very_deep = 200000
# test that loading highly-nested objects doesn't segfault when C
self.dumps(d)
@support.skip_emscripten_stack_overflow()
+ @support.skip_wasi_stack_overflow()
def test_endless_recursion(self):
# See #12051
class EndlessJSONEncoder(self.json.JSONEncoder):
--- /dev/null
+Remove special-casing for C stack depth limits for WASI. Due to
+WebAssembly's built-in stack protection this does not pose a security
+concern.
# define Py_C_STACK_SIZE 1200000
#elif defined(__sparc__)
# 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 131072 // wasi-libc DEFAULT_STACK_SIZE
#elif defined(__hppa__) || defined(__powerpc64__)
# define Py_C_STACK_SIZE 2000000
#else