File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,6 +89,12 @@ def test_cpickle(_cache={}):
8989 _pickle .Pickler (io .BytesIO (), protocol = - 1 ).dump (l )
9090 _cache [n ] = l
9191
92+ def test_compiler_recursion ():
93+ # The compiler uses a scaling factor to support additional levels
94+ # of recursion. This is a sanity check of that scaling to ensure
95+ # it still throws RuntimeError even at higher recursion limits
96+ compile ("()" * (10 * sys .getrecursionlimit ()), "<single>" , "single" )
97+
9298def check_limit (n , test_func_name ):
9399 sys .setrecursionlimit (n )
94100 if test_func_name .startswith ("test_" ):
@@ -117,5 +123,6 @@ def check_limit(n, test_func_name):
117123 check_limit (limit , "test_getattr" )
118124 check_limit (limit , "test_getitem" )
119125 check_limit (limit , "test_cpickle" )
126+ check_limit (limit , "test_compiler_recursion" )
120127 print ("Limit of %d is fine" % limit )
121128 limit = limit + 100
You can’t perform that action at this time.
0 commit comments