summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-07-29 14:18:47 (GMT)
committerGitHub <noreply@github.com>2019-07-29 14:18:47 (GMT)
commitcf52bd0b9b1c1b7ecdd91e1ebebd15ae5c213a2c (patch)
tree9b1dd786e0081346c2b551b3ed11ddcacb76194b /Parser
parent36fd7b6f01127bc6a8b4a37a363e0aa9cfd76506 (diff)
downloadcpython-cf52bd0b9b1c1b7ecdd91e1ebebd15ae5c213a2c.zip
cpython-cf52bd0b9b1c1b7ecdd91e1ebebd15ae5c213a2c.tar.gz
cpython-cf52bd0b9b1c1b7ecdd91e1ebebd15ae5c213a2c.tar.bz2
Fix `SyntaxError` indicator printing too many spaces for multi-line strings (GH-14433)
(cherry picked from commit 5b94f3578c662d5f1ee90c0e6b81481d9ec82d89) Co-authored-by: Anthony Sottile <asottile@umich.edu>
Diffstat (limited to 'Parser')
-rw-r--r--Parser/tokenizer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index c2ec659..31fe970 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -956,6 +956,7 @@ tok_nextc(struct tok_state *tok)
while (!done) {
Py_ssize_t curstart = tok->start == NULL ? -1 :
tok->start - tok->buf;
+ Py_ssize_t cur_multi_line_start = tok->multi_line_start - tok->buf;
Py_ssize_t curvalid = tok->inp - tok->buf;
Py_ssize_t newsize = curvalid + BUFSIZ;
char *newbuf = tok->buf;
@@ -968,6 +969,7 @@ tok_nextc(struct tok_state *tok)
}
tok->buf = newbuf;
tok->cur = tok->buf + cur;
+ tok->multi_line_start = tok->buf + cur_multi_line_start;
tok->line_start = tok->cur;
tok->inp = tok->buf + curvalid;
tok->end = tok->buf + newsize;