bpo-11105: reduce the recursion limit for tests (GH-26550)

This commit is contained in:
Batuhan Taskaya 2021-06-08 19:55:10 +03:00 committed by GitHub
parent 257e400a19
commit e58d762c1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -1102,7 +1102,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)
@ -1110,7 +1111,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):