summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-02-16 15:42:50 (GMT)
committerGuido van Rossum <guido@python.org>1998-02-16 15:42:50 (GMT)
commit35685240a91dbb3e4fb0e0b343019ba586e531c2 (patch)
tree087867e24f31aa95d25e91deed4486c5f0dd38f7
parent9d20ac36a9eaee175955b00a2d582480e4b9c66f (diff)
downloadcpython-35685240a91dbb3e4fb0e0b343019ba586e531c2.zip
cpython-35685240a91dbb3e4fb0e0b343019ba586e531c2.tar.gz
cpython-35685240a91dbb3e4fb0e0b343019ba586e531c2.tar.bz2
Fixed the bug in searching for triple quotes -- change the 'quote2'
variable from a pointer to an index, so a realloc() of the buffer won't disturb it. Problem found by Vladimir Marangozov.
-rw-r--r--Parser/tokenizer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 134f00f..ce397df 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -672,7 +672,7 @@ PyTokenizer_Get(tok, p_start, p_end)
letter_quote:
/* String */
if (c == '\'' || c == '"') {
- char *quote2 = tok->cur+1;
+ int quote2 = tok->cur - tok->start + 1;
int quote = c;
int triple = 0;
int tripcount = 0;
@@ -693,7 +693,7 @@ PyTokenizer_Get(tok, p_start, p_end)
}
else if (c == quote) {
tripcount++;
- if (tok->cur == quote2) {
+ if (tok->cur - tok->start == quote2) {
c = tok_nextc(tok);
if (c == quote) {
triple = 1;