summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-06-02 01:04:27 (GMT)
committerGitHub <noreply@github.com>2022-06-02 01:04:27 (GMT)
commit376d53771d4c109876fd3d002fb8aa5e2c8dec89 (patch)
treedd81e8a64947342b90d87797c18258369a306df0 /Parser
parentae0cf8eab59558816961a1f4ec94427bbb39eb80 (diff)
downloadcpython-376d53771d4c109876fd3d002fb8aa5e2c8dec89.zip
cpython-376d53771d4c109876fd3d002fb8aa5e2c8dec89.tar.gz
cpython-376d53771d4c109876fd3d002fb8aa5e2c8dec89.tar.bz2
gh-93418: Fix an assert when an f-string expression is followed by an '=', but no closing brace. (gh-93419) (gh-93422)
(cherry picked from commit ee70c70aa93d7a41cbe47a0b361b17f9d7ec8acd) Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com> Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
Diffstat (limited to 'Parser')
-rw-r--r--Parser/string_parser.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Parser/string_parser.c b/Parser/string_parser.c
index 9c12d8c..5e94d47 100644
--- a/Parser/string_parser.c
+++ b/Parser/string_parser.c
@@ -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) {