diff options
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r-- | Lib/test/test_syntax.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 6286529d273..c95bc15e727 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -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()) |