summaryrefslogtreecommitdiffstats
path: root/Parser/pegen.c
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2021-05-04 00:32:46 (GMT)
committerGitHub <noreply@github.com>2021-05-04 00:32:46 (GMT)
commit9142088e7454a392b69a627863b235ecc32aea54 (patch)
tree87be7dd5e9a05f75791872a0cf694bf7fad2e9ba /Parser/pegen.c
parent0aaf13a7140f411c2f1e7b206e1331ad8589ebed (diff)
downloadcpython-9142088e7454a392b69a627863b235ecc32aea54.zip
cpython-9142088e7454a392b69a627863b235ecc32aea54.tar.gz
cpython-9142088e7454a392b69a627863b235ecc32aea54.tar.bz2
bpo-43822: Prioritize tokenizer errors over custom syntax errors when raising parser exceptions (GH-25866)
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) {