]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
test_ast uses infinite_recursion() to prevent crash (GH-100104)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 8 Dec 2022 08:52:02 +0000 (00:52 -0800)
committerGitHub <noreply@github.com>
Thu, 8 Dec 2022 08:52:02 +0000 (00:52 -0800)
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.
(cherry picked from commit cd67c1bb30eccd0c6fd1386405df225aed4c91a9)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/test_ast.py

index 7581adc8fc272b3d2587f762c43afbc2db152040..c33c0ae22379ce32b539419abc4bf613dd1a6178 100644 (file)
@@ -831,7 +831,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")