summaryrefslogtreecommitdiffstats
path: root/Tools/scripts
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-11-04 14:19:49 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2012-11-04 14:19:49 (GMT)
commit8155f8e5d412d30ee87081879d21541ea9c20a51 (patch)
treeefaf03518aa48b37930886587f220eeafce10a1d /Tools/scripts
parente69bfc3fb6b8f241831d06b0dc9561ce9ac0ef8d (diff)
parent10d6ddeef19a69ab9a73e64a3a9a82c50a4160a2 (diff)
downloadcpython-8155f8e5d412d30ee87081879d21541ea9c20a51.zip
cpython-8155f8e5d412d30ee87081879d21541ea9c20a51.tar.gz
cpython-8155f8e5d412d30ee87081879d21541ea9c20a51.tar.bz2
Issue #5765: Merge from 3.3
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-xTools/scripts/find_recursionlimit.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Tools/scripts/find_recursionlimit.py b/Tools/scripts/find_recursionlimit.py
index 7a86603..c42de7f 100755
--- a/Tools/scripts/find_recursionlimit.py
+++ b/Tools/scripts/find_recursionlimit.py
@@ -89,6 +89,12 @@ def test_cpickle(_cache={}):
_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_"):
@@ -117,5 +123,6 @@ if __name__ == '__main__':
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