summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2020-04-12 21:21:00 +0300
committerGitHub <noreply@github.com>2020-04-12 19:21:00 +0100
commit41d5b94af44e34ac05d4cd57460ed104ccf96628 (patch)
tree564847a328b623cc02268a93fda371e0bea797b3 /Parser/tokenizer.c
parentbpo-31758: Prevent crashes when using an uninitialized _elementtree.XMLParser... (diff)
downloadcpython-41d5b94af44e34ac05d4cd57460ed104ccf96628.tar.gz
cpython-41d5b94af44e34ac05d4cd57460ed104ccf96628.tar.bz2
cpython-41d5b94af44e34ac05d4cd57460ed104ccf96628.zip
bpo-40246: Report a better error message for invalid string prefixes (GH-19476)
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r--Parser/tokenizer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index c650442a4a7..97986aa8ef4 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1392,6 +1392,10 @@ tok_get(struct tok_state *tok, const char **p_start, const char **p_end)
if (nonascii && !verify_identifier(tok)) {
return ERRORTOKEN;
}
+ if (c == '"' || c == '\'') {
+ tok->done = E_BADPREFIX;
+ return ERRORTOKEN;
+ }
*p_start = tok->start;
*p_end = tok->cur;