File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ def __getitem__(self, key):
108
108
exec ('z = a' , g , d )
109
109
self .assertEqual (d ['z' ], 12 )
110
110
111
+ @unittest .skipIf (support .is_wasi , "exhausts limited stack on WASI" )
111
112
def test_extended_arg (self ):
112
113
# default: 1000 * 2.5 = 2500 repetitions
113
114
repeat = int (sys .getrecursionlimit () * 2.5 )
@@ -542,6 +543,7 @@ def test_yet_more_evil_still_undecodable(self):
542
543
self .assertIn (b"Non-UTF-8" , res .err )
543
544
544
545
@support .cpython_only
546
+ @unittest .skipIf (support .is_wasi , "exhausts limited stack on WASI" )
545
547
def test_compiler_recursion_limit (self ):
546
548
# Expected limit is sys.getrecursionlimit() * the scaling factor
547
549
# in symtable.c (currently 3)
Original file line number Diff line number Diff line change 1
1
# Test the most dynamic corner cases of Python's runtime semantics.
2
2
3
3
import builtins
4
+ import sys
4
5
import unittest
5
6
6
7
from test .support import swap_item , swap_attr
@@ -139,12 +140,14 @@ class MyGlobals(dict):
139
140
def __missing__ (self , key ):
140
141
return int (key .removeprefix ("_number_" ))
141
142
142
- code = "lambda: " + "+" .join (f"_number_{ i } " for i in range (1000 ))
143
- sum_1000 = eval (code , MyGlobals ())
144
- expected = sum (range (1000 ))
143
+ # 1,000 on most systems
144
+ limit = sys .getrecursionlimit ()
145
+ code = "lambda: " + "+" .join (f"_number_{ i } " for i in range (limit ))
146
+ sum_func = eval (code , MyGlobals ())
147
+ expected = sum (range (limit ))
145
148
# Warm up the the function for quickening (PEP 659)
146
149
for _ in range (30 ):
147
- self .assertEqual (sum_1000 (), expected )
150
+ self .assertEqual (sum_func (), expected )
148
151
149
152
if __name__ == "__main__" :
150
153
unittest .main ()
You can’t perform that action at this time.
0 commit comments