bpo-46110: Restore commit e9898bf153

This restores commit e9898bf153 .
This commit is contained in:
Pablo Galindo Salgado 2022-01-03 19:54:06 +00:00 committed by GitHub
parent 9d6a239a34
commit dd6c35761a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 4602 additions and 3197 deletions

View file

@ -1729,6 +1729,14 @@ while 1:
"""
self._check_error(source, "too many statically nested blocks")
@support.cpython_only
def test_error_on_parser_stack_overflow(self):
source = "-" * 100000 + "4"
for mode in ["exec", "eval", "single"]:
with self.subTest(mode=mode):
with self.assertRaises(MemoryError):
compile(source, "<string>", mode)
def load_tests(loader, tests, pattern):
tests.addTest(doctest.DocTestSuite())