Fix SyntaxError indicator printing too many spaces for multi-line strings (GH-14433)

This commit is contained in:
Anthony Sottile 2019-07-29 06:59:13 -07:00 committed by Pablo Galindo
parent e1b9002472
commit 5b94f3578c
3 changed files with 17 additions and 0 deletions

View file

@ -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;