summaryrefslogtreecommitdiffstats
path: root/Parser/pegen.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-05-04 01:06:45 (GMT)
committerGitHub <noreply@github.com>2021-05-04 01:06:45 (GMT)
commit756b7b9248885d65c2b3b9f1c5a8f66aa2e8de7a (patch)
tree7d72197323ead46e2016c62236aa88293d70300f /Parser/pegen.c
parent4d58730a3ade8dff09619ec8a7a01ef01bff99d1 (diff)
downloadcpython-756b7b9248885d65c2b3b9f1c5a8f66aa2e8de7a.zip
cpython-756b7b9248885d65c2b3b9f1c5a8f66aa2e8de7a.tar.gz
cpython-756b7b9248885d65c2b3b9f1c5a8f66aa2e8de7a.tar.bz2
bpo-43822: Prioritize tokenizer errors over custom syntax errors when raising parser exceptions (GH-25866)
(cherry picked from commit 9142088e7454a392b69a627863b235ecc32aea54) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Diffstat (limited to 'Parser/pegen.c')
-rw-r--r--Parser/pegen.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Parser/pegen.c b/Parser/pegen.c
index e32b271..6080cec 100644
--- a/Parser/pegen.c
+++ b/Parser/pegen.c
@@ -1283,6 +1283,9 @@ _PyPegen_run_parser(Parser *p)
reset_parser_state(p);
_PyPegen_parse(p);
if (PyErr_Occurred()) {
+ if (PyErr_ExceptionMatches(PyExc_SyntaxError)) {
+ _PyPegen_check_tokenizer_errors(p);
+ }
return NULL;
}
if (p->fill == 0) {