summaryrefslogtreecommitdiffstats
path: root/Tools/peg_generator
diff options
context:
space:
mode:
authorDennis Sweeney <36520290+sweeneyde@users.noreply.github.com>2023-08-22 07:41:50 (GMT)
committerGitHub <noreply@github.com>2023-08-22 07:41:50 (GMT)
commit86617518c4ac824e2b6dc20691ba5a08df04f285 (patch)
treed2510cb804fca7f5835caa4f77facbce0fff97c6 /Tools/peg_generator
parent7f87ebbc3f52680c939791f397b9a478edf0c8d4 (diff)
downloadcpython-86617518c4ac824e2b6dc20691ba5a08df04f285.zip
cpython-86617518c4ac824e2b6dc20691ba5a08df04f285.tar.gz
cpython-86617518c4ac824e2b6dc20691ba5a08df04f285.tar.bz2
gh-108179: Add error message for parser stack overflows (#108256)
Diffstat (limited to 'Tools/peg_generator')
-rw-r--r--Tools/peg_generator/pegen/c_generator.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py
index f57b627..301949b 100644
--- a/Tools/peg_generator/pegen/c_generator.py
+++ b/Tools/peg_generator/pegen/c_generator.py
@@ -375,8 +375,7 @@ class CParserGenerator(ParserGenerator, GrammarVisitor):
def add_level(self) -> None:
self.print("if (p->level++ == MAXSTACK) {")
with self.indent():
- self.print("p->error_indicator = 1;")
- self.print("PyErr_NoMemory();")
+ self.print("_Pypegen_stack_overflow(p);")
self.print("}")
def remove_level(self) -> None: