mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[3.12] gh-105820: Fix tok_mode expression buffer in file & readline tokenizer (GH-105828) (#105832)
(cherry picked from commit d382ad4915
)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
parent
abb4eaa46f
commit
e9cf5a324e
4 changed files with 38 additions and 4 deletions
|
@ -1039,9 +1039,6 @@ tok_readline_raw(struct tok_state *tok)
|
|||
if (line == NULL) {
|
||||
return 1;
|
||||
}
|
||||
if (tok->tok_mode_stack_index && !update_fstring_expr(tok, 0)) {
|
||||
return 0;
|
||||
}
|
||||
if (tok->fp_interactive &&
|
||||
tok_concatenate_interactive_new_line(tok, line) == -1) {
|
||||
return 0;
|
||||
|
@ -1270,6 +1267,10 @@ tok_underflow_file(struct tok_state *tok) {
|
|||
tok->implicit_newline = 1;
|
||||
}
|
||||
|
||||
if (tok->tok_mode_stack_index && !update_fstring_expr(tok, 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ADVANCE_LINENO();
|
||||
if (tok->decoding_state != STATE_NORMAL) {
|
||||
if (tok->lineno > 2) {
|
||||
|
@ -1314,6 +1315,10 @@ tok_underflow_readline(struct tok_state* tok) {
|
|||
tok->implicit_newline = 1;
|
||||
}
|
||||
|
||||
if (tok->tok_mode_stack_index && !update_fstring_expr(tok, 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ADVANCE_LINENO();
|
||||
/* The default encoding is UTF-8, so make sure we don't have any
|
||||
non-UTF-8 sequences in it. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue