mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
bpo-11105: document the new test.support.infinite_recursion context manager (GH-26604)
This commit is contained in:
parent
e58d762c1f
commit
8004c4570b
1 changed files with 7 additions and 1 deletions
|
@ -49,7 +49,7 @@ __all__ = [
|
||||||
# processes
|
# processes
|
||||||
"reap_children",
|
"reap_children",
|
||||||
# miscellaneous
|
# miscellaneous
|
||||||
"run_with_locale", "swap_item", "findfile",
|
"run_with_locale", "swap_item", "findfile", "infinite_recursion",
|
||||||
"swap_attr", "Matcher", "set_memlimit", "SuppressCrashReport", "sortdict",
|
"swap_attr", "Matcher", "set_memlimit", "SuppressCrashReport", "sortdict",
|
||||||
"run_with_tz", "PGO", "missing_compiler_executable",
|
"run_with_tz", "PGO", "missing_compiler_executable",
|
||||||
"ALWAYS_EQ", "NEVER_EQ", "LARGEST", "SMALLEST",
|
"ALWAYS_EQ", "NEVER_EQ", "LARGEST", "SMALLEST",
|
||||||
|
@ -2002,6 +2002,12 @@ def check_disallow_instantiation(testcase, tp, *args, **kwds):
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def infinite_recursion(max_depth=75):
|
def infinite_recursion(max_depth=75):
|
||||||
|
"""Set a lower limit for tests that interact with infinite recursions
|
||||||
|
(e.g test_ast.ASTHelpers_Test.test_recursion_direct) since on some
|
||||||
|
debug windows builds, due to not enough functions being inlined the
|
||||||
|
stack size might not handle the default recursion limit (1000). See
|
||||||
|
bpo-11105 for details."""
|
||||||
|
|
||||||
original_depth = sys.getrecursionlimit()
|
original_depth = sys.getrecursionlimit()
|
||||||
try:
|
try:
|
||||||
sys.setrecursionlimit(max_depth)
|
sys.setrecursionlimit(max_depth)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue