summaryrefslogtreecommitdiff
path: root/Lib/test/test_ast.py
diff options
context:
space:
mode:
authorBatuhan Taskaya <batuhan@python.org>2021-06-08 20:39:30 +0300
committerGitHub <noreply@github.com>2021-06-08 20:39:30 +0300
commitbd6f0d3eadfe5623657db6aeb69b94d21f86f4a0 (patch)
tree8e5cd72c56fe4f56ff26281f66940ef2530eb483 /Lib/test/test_ast.py
parent75185561a9a3b6dede3ad87bd83bab66847bd425 (diff)
downloadcpython-git-bd6f0d3eadfe5623657db6aeb69b94d21f86f4a0.tar.gz
[3.10] bpo-11105: reduce the recursion limit for tests. (GH-26607)
(cherry picked from commit e58d762c1fb4ad5e021d016c80c2bc4513632d2f) Co-authored-by: Batuhan Taskaya <batuhan@python.org>
Diffstat (limited to 'Lib/test/test_ast.py')
-rw-r--r--Lib/test/test_ast.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index e08a965d96..a44f8f551c 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -1101,7 +1101,8 @@ Module(
e = ast.UnaryOp(op=ast.Not(), lineno=0, col_offset=0)
e.operand = e
with self.assertRaises(RecursionError):
- compile(ast.Expression(e), "<test>", "eval")
+ with support.infinite_recursion():
+ compile(ast.Expression(e), "<test>", "eval")
def test_recursion_indirect(self):
e = ast.UnaryOp(op=ast.Not(), lineno=0, col_offset=0)
@@ -1109,7 +1110,8 @@ Module(
e.operand = f
f.operand = e
with self.assertRaises(RecursionError):
- compile(ast.Expression(e), "<test>", "eval")
+ with support.infinite_recursion():
+ compile(ast.Expression(e), "<test>", "eval")
class ASTValidatorTests(unittest.TestCase):