Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Lib/test/test_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,14 @@ def test_syntax_error_on_deeply_nested_blocks(self):
"""
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 test_main():
support.run_unittest(SyntaxTestCase)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add a maximum recursion check to the PEG parser to avoid stack overflow.
Patch by Pablo Galindo
Loading