_pickle.Pickler(io.BytesIO(), protocol=-1).dump(l)
_cache[n] = l
+def test_compiler_recursion():
+ # The compiler uses a scaling factor to support additional levels
+ # of recursion. This is a sanity check of that scaling to ensure
+ # it still throws RuntimeError even at higher recursion limits
+ compile("()" * (10 * sys.getrecursionlimit()), "<single>", "single")
+
def check_limit(n, test_func_name):
sys.setrecursionlimit(n)
if test_func_name.startswith("test_"):
check_limit(limit, "test_getattr")
check_limit(limit, "test_getitem")
check_limit(limit, "test_cpickle")
+ check_limit(limit, "test_compiler_recursion")
print("Limit of %d is fine" % limit)
limit = limit + 100