summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorMarta Gómez Macías <mgmacias@google.com>2023-05-27 16:50:43 (GMT)
committerGitHub <noreply@github.com>2023-05-27 16:50:43 (GMT)
commit86d8f489359b8f6cc15006bdcbd70521ce621fbb (patch)
tree3e839dd6d5e8811fd15f670e35a2db65521c86df /Parser
parent6e62eb2e70a9f2a8099735989a58e8c8cfb4a2f2 (diff)
downloadcpython-86d8f489359b8f6cc15006bdcbd70521ce621fbb.zip
cpython-86d8f489359b8f6cc15006bdcbd70521ce621fbb.tar.gz
cpython-86d8f489359b8f6cc15006bdcbd70521ce621fbb.tar.bz2
gh-105017: Fix including additional NL token when using CRLF (#105022)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Parser')
-rw-r--r--Parser/tokenizer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index a7651b1..a84c249 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -800,7 +800,7 @@ translate_newlines(const char *s, int exec_input, struct tok_state *tok) {
}
/* If this is exec input, add a newline to the end of the string if
there isn't one already. */
- if (exec_input && c != '\n') {
+ if (exec_input && c != '\n' && c != '\0') {
*current = '\n';
current++;
}