]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fixed the bug in searching for triple quotes -- change the 'quote2'
authorGuido van Rossum <guido@python.org>
Mon, 16 Feb 1998 15:42:50 +0000 (15:42 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 16 Feb 1998 15:42:50 +0000 (15:42 +0000)
variable from a pointer to an index, so a realloc() of the buffer
won't disturb it.  Problem found by Vladimir Marangozov.

Parser/tokenizer.c

index 134f00f252bfac35ca4680ebb948bb47ea1aa41f..ce397df45783fa24adf29b16708ef2ccd7c69877 100644 (file)
@@ -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;