[3.12] gh-108179: Add error message for parser stack overflows (GH-108256) (#108263)

gh-108179: Add error message for parser stack overflows (GH-108256)
(cherry picked from commit 86617518c4)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2023-08-22 03:02:32 -07:00 committed by GitHub
parent ef4d427fd8
commit 149d70c254
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 542 additions and 1063 deletions

View file

@ -2335,7 +2335,7 @@ while 1:
source = "-" * 100000 + "4"
for mode in ["exec", "eval", "single"]:
with self.subTest(mode=mode):
with self.assertRaises(MemoryError):
with self.assertRaisesRegex(MemoryError, r"too complex"):
compile(source, "<string>", mode)
@support.cpython_only