def check_limit(n, test_func_name):
sys.setrecursionlimit(n)
if test_func_name.startswith("test_"):
print test_func_name[5:]
else:
print test_func_name
test_func = globals()[test_func_name]
try:
test_func()
# AttributeError can be raised because of the way e.g. PyDict_GetItem()
# silences all exceptions and returns NULL, which is usually interpreted
# as "missing attribute".
except (RuntimeError, AttributeError):
pass
else:
print "Yikes!"
find_recursionlimit.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录