[Python-checkins] cpython (3.3): Issue #5765: Also check the compiler when finding the recursion limit

nick.coghlan python-checkins at python.org
Sun Nov 4 15:20:02 CET 2012


http://hg.python.org/cpython/rev/cf2515d0328b
changeset:   80241:cf2515d0328b
branch:      3.3
parent:      80239:ab02cd145f56
user:        Nick Coghlan <ncoghlan at gmail.com>
date:        Mon Nov 05 00:19:18 2012 +1000
summary:
  Issue #5765: Also check the compiler when finding the recursion limit

files:
  Tools/scripts/find_recursionlimit.py |  7 +++++++
  1 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/Tools/scripts/find_recursionlimit.py b/Tools/scripts/find_recursionlimit.py
--- a/Tools/scripts/find_recursionlimit.py
+++ b/Tools/scripts/find_recursionlimit.py
@@ -89,6 +89,12 @@
         _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 @@
         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

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list