mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[3.12] gh-122026: Fix identification of mismatched parentheses inside f-strings (GH-122028) (#122062)
(cherry picked from commit 2009e25e26
)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
This commit is contained in:
parent
0298da432d
commit
966eff9ce4
3 changed files with 6 additions and 0 deletions
|
@ -2607,6 +2607,9 @@ letter_quote:
|
|||
|
||||
if (INSIDE_FSTRING(tok)) {
|
||||
current_tok->curly_bracket_depth--;
|
||||
if (current_tok->curly_bracket_depth < 0) {
|
||||
return MAKE_TOKEN(syntaxerror(tok, "f-string: unmatched '%c'", c));
|
||||
}
|
||||
if (c == '}' && current_tok->curly_bracket_depth ==
|
||||
current_tok->curly_bracket_expr_start_depth) {
|
||||
current_tok->curly_bracket_expr_start_depth--;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue