summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/find_recursionlimit.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-04-05 01:28:14 (GMT)
committerR David Murray <rdmurray@bitdance.com>2012-04-05 01:28:14 (GMT)
commit54ac832a24a0f40ea3278707420b191be3619c99 (patch)
tree67046379cb835bbc0e4e2b0e387ec763222e8814 /Tools/scripts/find_recursionlimit.py
parentb6046301ef70ca30f106038cf3799278e770d3ca (diff)
downloadcpython-54ac832a24a0f40ea3278707420b191be3619c99.zip
cpython-54ac832a24a0f40ea3278707420b191be3619c99.tar.gz
cpython-54ac832a24a0f40ea3278707420b191be3619c99.tar.bz2
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
This patch changes a few of the scripts to have __name__=='__main__' clauses so that they are importable without running. Also fixes the syntax errors revealed by the tests.
Diffstat (limited to 'Tools/scripts/find_recursionlimit.py')
-rwxr-xr-xTools/scripts/find_recursionlimit.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/Tools/scripts/find_recursionlimit.py b/Tools/scripts/find_recursionlimit.py
index 443f052..7a86603 100755
--- a/Tools/scripts/find_recursionlimit.py
+++ b/Tools/scripts/find_recursionlimit.py
@@ -106,14 +106,16 @@ def check_limit(n, test_func_name):
else:
print("Yikes!")
-limit = 1000
-while 1:
- check_limit(limit, "test_recurse")
- check_limit(limit, "test_add")
- check_limit(limit, "test_repr")
- check_limit(limit, "test_init")
- check_limit(limit, "test_getattr")
- check_limit(limit, "test_getitem")
- check_limit(limit, "test_cpickle")
- print("Limit of %d is fine" % limit)
- limit = limit + 100
+if __name__ == '__main__':
+
+ limit = 1000
+ while 1:
+ check_limit(limit, "test_recurse")
+ check_limit(limit, "test_add")
+ check_limit(limit, "test_repr")
+ check_limit(limit, "test_init")
+ check_limit(limit, "test_getattr")
+ check_limit(limit, "test_getitem")
+ check_limit(limit, "test_cpickle")
+ print("Limit of %d is fine" % limit)
+ limit = limit + 100