Skip to content

Commit 5e632fb

Browse files
committed
use strchr to compare
1 parent ecf7b35 commit 5e632fb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
In REPL, dont switch to PS2 if the line starts with comment or whitespace.
1+
In REPL mode, don't switch to PS2 if the line starts with comment or whitespace. Patch by Batuhan Taşkaya.

Parser/tokenizer.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,10 +875,12 @@ tok_nextc(struct tok_state *tok)
875875
Py_DECREF(u);
876876
}
877877
if (tok->nextprompt != NULL) {
878-
if (newtok != NULL && (*newtok == '#' || *newtok == ' ' || *newtok == '\t'))
878+
if (newtok != NULL && strchr("# \t", *newtok)) {
879879
tok->nextprompt = NULL;
880-
else
880+
}
881+
else {
881882
tok->prompt = tok->nextprompt;
883+
}
882884
}
883885
if (newtok == NULL)
884886
tok->done = E_INTR;

0 commit comments

Comments
 (0)