Skip to content

Commit 09f4d22

Browse files
committed
fixup! fixup! pythongh-96670: Raise SyntaxError when parsing NULL bytes
1 parent 7b23309 commit 09f4d22

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

‎Parser/tokenizer.c‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,9 @@ tok_reserve_buf(struct tok_state *tok, Py_ssize_t size)
378378
return 1;
379379
}
380380

381-
static int
381+
static inline int
382382
contains_null_bytes(const char* str, size_t size) {
383-
for (size_t i =0; i < size; i++) {
384-
if (str[i] == '\0') {
385-
return 1;
386-
}
387-
}
388-
return 0;
383+
return memchr(str, 0, size) != NULL;
389384
}
390385

391386
static int

0 commit comments

Comments
 (0)