diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2020-01-06 15:59:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-06 15:59:09 (GMT) |
commit | 5ec91f78d59d9c39b984f284e00cd04b96ddb5db (patch) | |
tree | 3584ef9005da8bc532c12665147c8313142ff0e6 /Parser | |
parent | 075ebad369d94342624792a41d3055c907bfa436 (diff) | |
download | cpython-5ec91f78d59d9c39b984f284e00cd04b96ddb5db.zip cpython-5ec91f78d59d9c39b984f284e00cd04b96ddb5db.tar.gz cpython-5ec91f78d59d9c39b984f284e00cd04b96ddb5db.tar.bz2 |
bpo-39209: Manage correctly multi-line tokens in interactive mode (GH-17860)
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/tokenizer.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index f84093d..f73c326 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -886,6 +886,7 @@ tok_nextc(struct tok_state *tok) size_t start = tok->start - tok->buf; size_t oldlen = tok->cur - tok->buf; size_t newlen = oldlen + strlen(newtok); + Py_ssize_t cur_multi_line_start = tok->multi_line_start - tok->buf; char *buf = tok->buf; buf = (char *)PyMem_REALLOC(buf, newlen+1); tok->lineno++; @@ -898,6 +899,7 @@ tok_nextc(struct tok_state *tok) } tok->buf = buf; tok->cur = tok->buf + oldlen; + tok->multi_line_start = tok->buf + cur_multi_line_start; tok->line_start = tok->cur; strcpy(tok->buf + oldlen, newtok); PyMem_FREE(newtok); |