summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-12-08 08:52:02 (GMT)
committerGitHub <noreply@github.com>2022-12-08 08:52:02 (GMT)
commit42fde2d164eb6f9c31a01b290114026d857676ad (patch)
tree9a81497523c2c02ddc2f8f188fd1e7f159d978e3
parentd4426c829565e3ef922c091ee9bd48bc556f2550 (diff)
downloadcpython-42fde2d164eb6f9c31a01b290114026d857676ad.zip
cpython-42fde2d164eb6f9c31a01b290114026d857676ad.tar.gz
cpython-42fde2d164eb6f9c31a01b290114026d857676ad.tar.bz2
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 <vstinner@python.org>
-rw-r--r--Lib/test/test_ast.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index 7581adc..c33c0ae 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -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")