From 619c46756e039aac9dca045dadda6adb6492b9e6 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 8 Dec 2022 09:26:38 +0100 Subject: [PATCH] test_ast uses infinite_recursion() to prevent crash (GH-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. (cherry picked from commit cd67c1bb30eccd0c6fd1386405df225aed4c91a9) Co-authored-by: Victor Stinner --- Lib/test/test_ast.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 7581adc8fc272b..c33c0ae22379ce 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -831,7 +831,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")