Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad42dc1

Browse files
authored
GH-130397: remove special-casing of C stack depth for WASI (#134469)
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.
1 parent742d5b5 commitad42dc1

File tree

8 files changed

+15
-7
lines changed

8 files changed

+15
-7
lines changed

‎Include/pythonrun.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ PyAPI_DATA(int) (*PyOS_InputHook)(void);
2929
# definePYOS_LOG2_STACK_MARGIN 12
3030
#elif defined(Py_DEBUG)&& defined(WIN32)
3131
# definePYOS_LOG2_STACK_MARGIN 12
32-
#elif defined(__wasi__)
33-
/* Web assembly has two stacks, so this isn't really a size */
34-
# definePYOS_LOG2_STACK_MARGIN 9
3532
#else
3633
# definePYOS_LOG2_STACK_MARGIN 11
3734
#endif

‎Lib/test/test_copy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ def test_deepcopy_list(self):
372372
self.assertIsNot(x[0],y[0])
373373

374374
@support.skip_emscripten_stack_overflow()
375+
@support.skip_wasi_stack_overflow()
375376
deftest_deepcopy_reflexive_list(self):
376377
x= []
377378
x.append(x)
@@ -400,6 +401,7 @@ def test_deepcopy_tuple_of_immutables(self):
400401
self.assertIs(x,y)
401402

402403
@support.skip_emscripten_stack_overflow()
404+
@support.skip_wasi_stack_overflow()
403405
deftest_deepcopy_reflexive_tuple(self):
404406
x= ([],)
405407
x[0].append(x)
@@ -418,6 +420,7 @@ def test_deepcopy_dict(self):
418420
self.assertIsNot(x["foo"],y["foo"])
419421

420422
@support.skip_emscripten_stack_overflow()
423+
@support.skip_wasi_stack_overflow()
421424
deftest_deepcopy_reflexive_dict(self):
422425
x= {}
423426
x['foo']=x

‎Lib/test/test_descr.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3943,6 +3943,7 @@ def __del__(self):
39433943
delC.__del__
39443944

39453945
@unittest.skipIf(support.is_emscripten,"Seems to works in Pyodide?")
3946+
@support.skip_wasi_stack_overflow()
39463947
deftest_slots_trash(self):
39473948
# Testing slot trash...
39483949
# Deallocating deeply nested slotted trash caused stack overflows
@@ -4868,6 +4869,7 @@ class Thing:
48684869
deque.append(thing,thing)
48694870

48704871
@support.skip_emscripten_stack_overflow()
4872+
@support.skip_wasi_stack_overflow()
48714873
deftest_repr_as_str(self):
48724874
# Issue #11603: crash or infinite loop when rebinding __str__ as
48734875
# __repr__.

‎Lib/test/test_exception_group.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
importcollections.abc
22
importtypes
33
importunittest
4-
fromtest.supportimportskip_emscripten_stack_overflow,exceeds_recursion_limit
4+
fromtest.supportimportskip_emscripten_stack_overflow,skip_wasi_stack_overflow,exceeds_recursion_limit
55

66
classTestExceptionGroupTypeHierarchy(unittest.TestCase):
77
deftest_exception_group_types(self):
@@ -465,12 +465,14 @@ def make_deep_eg(self):
465465
returne
466466

467467
@skip_emscripten_stack_overflow()
468+
@skip_wasi_stack_overflow()
468469
deftest_deep_split(self):
469470
e=self.make_deep_eg()
470471
withself.assertRaises(RecursionError):
471472
e.split(TypeError)
472473

473474
@skip_emscripten_stack_overflow()
475+
@skip_wasi_stack_overflow()
474476
deftest_deep_subgroup(self):
475477
e=self.make_deep_eg()
476478
withself.assertRaises(RecursionError):

‎Lib/test/test_isinstance.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ def __bases__(self):
318318
self.assertRaises(RecursionError,isinstance,1,X())
319319

320320
@support.skip_emscripten_stack_overflow()
321+
@support.skip_wasi_stack_overflow()
321322
deftest_infinite_recursion_via_bases_tuple(self):
322323
"""Regression test for bpo-30570."""
323324
classFailure(object):
@@ -328,6 +329,7 @@ def __getattr__(self, attr):
328329
issubclass(Failure(),int)
329330

330331
@support.skip_emscripten_stack_overflow()
332+
@support.skip_wasi_stack_overflow()
331333
deftest_infinite_cycle_in_bases(self):
332334
"""Regression test for bpo-30570."""
333335
classX:

‎Lib/test/test_json/test_recursion.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def default(self, o):
6969

7070

7171
@support.skip_emscripten_stack_overflow()
72+
@support.skip_wasi_stack_overflow()
7273
deftest_highly_nested_objects_decoding(self):
7374
very_deep=200000
7475
# test that loading highly-nested objects doesn't segfault when C
@@ -98,6 +99,7 @@ def test_highly_nested_objects_encoding(self):
9899
self.dumps(d)
99100

100101
@support.skip_emscripten_stack_overflow()
102+
@support.skip_wasi_stack_overflow()
101103
deftest_endless_recursion(self):
102104
# See #12051
103105
classEndlessJSONEncoder(self.json.JSONEncoder):
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Remove special-casing for C stack depth limits for WASI. Due to
2+
WebAssembly's built-in stack protection this does not pose a security
3+
concern.

‎Python/ceval.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,6 @@ _Py_EnterRecursiveCallUnchecked(PyThreadState *tstate)
360360
# definePy_C_STACK_SIZE 1200000
361361
#elif defined(__sparc__)
362362
# definePy_C_STACK_SIZE 1600000
363-
#elif defined(__wasi__)
364-
/* Web assembly has two stacks, so this isn't really the stack depth */
365-
# definePy_C_STACK_SIZE 131072 // wasi-libc DEFAULT_STACK_SIZE
366363
#elif defined(__hppa__)|| defined(__powerpc64__)
367364
# definePy_C_STACK_SIZE 2000000
368365
#else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp