mirror of https://github.com/python/cpython
gh-93418: Fix an assert when an f-string expression is followed by an '=', but no closing brace. (gh-93419)
This commit is contained in:
parent
8a221a8537
commit
ee70c70aa9
|
@ -1084,6 +1084,7 @@ x = (
|
|||
"f'{'",
|
||||
"f'x{<'", # See bpo-46762.
|
||||
"f'x{>'",
|
||||
"f'{i='", # See gh-93418.
|
||||
])
|
||||
|
||||
# But these are just normal strings.
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Fixed an assert where an f-string has an equal sign '=' following an
|
||||
expression, but there's no trailing brace. For example, f"{i=".
|
|
@ -756,7 +756,9 @@ fstring_find_expr(Parser *p, const char **str, const char *end, int raw, int rec
|
|||
while (Py_ISSPACE(**str)) {
|
||||
*str += 1;
|
||||
}
|
||||
|
||||
if (*str >= end) {
|
||||
goto unexpected_end_of_string;
|
||||
}
|
||||
/* Set *expr_text to the text of the expression. */
|
||||
*expr_text = PyUnicode_FromStringAndSize(expr_start, *str-expr_start);
|
||||
if (!*expr_text) {
|
||||
|
|
Loading…
Reference in New Issue