test_ast uses infinite_recursion() to prevent crash (#100104)

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.
This commit is contained in:
Victor Stinner 2022-12-08 09:26:38 +01:00 committed by GitHub
parent e8fff515f0
commit cd67c1bb30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -837,7 +837,8 @@ class AST_Tests(unittest.TestCase):
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")