]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
test_ast uses infinite_recursion() to prevent crash (#100104)
authorVictor Stinner <vstinner@python.org>
Thu, 8 Dec 2022 08:26:38 +0000 (09:26 +0100)
committerGitHub <noreply@github.com>
Thu, 8 Dec 2022 08:26:38 +0000 (09:26 +0100)
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.

Lib/test/test_ast.py

index 773fba87632b0a38a7d715bd66531a2013b92ee9..ab6a63faa59085e86f6801c956b2b8477be9eed5 100644 (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")