Skip to content

Commit

Permalink
test_ast uses infinite_recursion() to prevent crash
Browse files Browse the repository at this point in the history
test.test_ast_recursion_limit() now uses infinite_recursion() of
test.support to prevent crashes on debug builds.

Before this change, the test crashed on ARM64 Windows 3.x buildbot
worker which builds Python in debug mode.
  • Loading branch information
vstinner committed Dec 8, 2022
1 parent ded02ca commit 2cf754d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Lib/test/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,8 @@ def check_limit(prefix, repeated):
details = "Compiling ({!r} + {!r} * {})".format(
prefix, repeated, depth)
with self.assertRaises(RecursionError, msg=details):
ast.parse(broken)
with support.infinite_recursion():
ast.parse(broken)

check_limit("a", "()")
check_limit("a", ".b")
Expand Down

0 comments on commit 2cf754d

Please sign in to comment.