summaryrefslogtreecommitdiffstats
path: root/Parser/pegen_errors.c
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 /Parser/pegen_errors.c
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 'Parser/pegen_errors.c')
-rw-r--r--Parser/pegen_errors.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Parser/pegen_errors.c b/Parser/pegen_errors.c
index e543d40..f400936 100644
--- a/Parser/pegen_errors.c
+++ b/Parser/pegen_errors.c
@@ -454,3 +454,11 @@ _Pypegen_set_syntax_error(Parser* p, Token* last_token) {
// generic SyntaxError we just raised if errors are found.
_PyPegen_tokenize_full_source_to_check_for_errors(p);
}
+
+void
+_Pypegen_stack_overflow(Parser *p)
+{
+ p->error_indicator = 1;
+ PyErr_SetString(PyExc_MemoryError,
+ "Parser stack overflowed - Python source too complex to parse");
+}