mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-97556: Raise null bytes syntax error upon null in multiline string (GH-104136)
This commit is contained in:
parent
55d50d147c
commit
ef0df5284f
2 changed files with 21 additions and 1 deletions
|
@ -2301,8 +2301,12 @@ tok_get_normal_mode(struct tok_state *tok, tokenizer_mode* current_tok, struct t
|
|||
/* Get rest of string */
|
||||
while (end_quote_size != quote_size) {
|
||||
c = tok_nextc(tok);
|
||||
if (tok->done == E_DECODE)
|
||||
if (tok->done == E_ERROR) {
|
||||
return MAKE_TOKEN(ERRORTOKEN);
|
||||
}
|
||||
if (tok->done == E_DECODE) {
|
||||
break;
|
||||
}
|
||||
if (c == EOF || (quote_size == 1 && c == '\n')) {
|
||||
assert(tok->multi_line_start != NULL);
|
||||
// shift the tok_state's location into
|
||||
|
@ -2554,6 +2558,9 @@ f_string_middle:
|
|||
|
||||
while (end_quote_size != current_tok->f_string_quote_size) {
|
||||
int c = tok_nextc(tok);
|
||||
if (tok->done == E_ERROR) {
|
||||
return MAKE_TOKEN(ERRORTOKEN);
|
||||
}
|
||||
if (c == EOF || (current_tok->f_string_quote_size == 1 && c == '\n')) {
|
||||
if (tok->decoding_erred) {
|
||||
return MAKE_TOKEN(ERRORTOKEN);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue