Kaydet (Commit) 35685240 authored tarafından Guido van Rossum's avatar Guido van Rossum

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.
üst 9d20ac36
...@@ -672,7 +672,7 @@ PyTokenizer_Get(tok, p_start, p_end) ...@@ -672,7 +672,7 @@ PyTokenizer_Get(tok, p_start, p_end)
letter_quote: letter_quote:
/* String */ /* String */
if (c == '\'' || c == '"') { if (c == '\'' || c == '"') {
char *quote2 = tok->cur+1; int quote2 = tok->cur - tok->start + 1;
int quote = c; int quote = c;
int triple = 0; int triple = 0;
int tripcount = 0; int tripcount = 0;
...@@ -693,7 +693,7 @@ PyTokenizer_Get(tok, p_start, p_end) ...@@ -693,7 +693,7 @@ PyTokenizer_Get(tok, p_start, p_end)
} }
else if (c == quote) { else if (c == quote) {
tripcount++; tripcount++;
if (tok->cur == quote2) { if (tok->cur - tok->start == quote2) {
c = tok_nextc(tok); c = tok_nextc(tok);
if (c == quote) { if (c == quote) {
triple = 1; triple = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment