Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3568524

Browse files
committed
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.
1 parent 9d20ac3 commit 3568524

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Parser/tokenizer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ PyTokenizer_Get(tok, p_start, p_end)
672672
letter_quote:
673673
/* String */
674674
if (c == '\'' || c == '"') {
675-
char *quote2 = tok->cur+1;
675+
int quote2 = tok->cur - tok->start + 1;
676676
int quote = c;
677677
int triple = 0;
678678
int tripcount = 0;
@@ -693,7 +693,7 @@ PyTokenizer_Get(tok, p_start, p_end)
693693
}
694694
else if (c == quote) {
695695
tripcount++;
696-
if (tok->cur == quote2) {
696+
if (tok->cur - tok->start == quote2) {
697697
c = tok_nextc(tok);
698698
if (c == quote) {
699699
triple = 1;

0 commit comments

Comments
 (0)