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:
Eric V. Smith 2022-06-01 19:20:06 -04:00 committed by GitHub
parent 8a221a8537
commit ee70c70aa9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View file

@ -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) {