Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
bpo-11105: document the new test.support.infinite_recursion context m…
…anager
  • Loading branch information
isidentical committed Jun 8, 2021
commit 237f3102b7b82966c20e78c4e6dd2dda6a18d837
8 changes: 7 additions & 1 deletion Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# processes
"reap_children",
# miscellaneous
"run_with_locale", "swap_item", "findfile",
"run_with_locale", "swap_item", "findfile", "infinite_recursion",
"swap_attr", "Matcher", "set_memlimit", "SuppressCrashReport", "sortdict",
"run_with_tz", "PGO", "missing_compiler_executable",
"ALWAYS_EQ", "NEVER_EQ", "LARGEST", "SMALLEST",
Expand Down Expand Up @@ -2002,6 +2002,12 @@ def check_disallow_instantiation(testcase, tp, *args, **kwds):

@contextlib.contextmanager
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()
try:
sys.setrecursionlimit(max_depth)
Expand Down