summaryrefslogtreecommitdiffstats
path: root/Parser/pegen/parse_string.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-02-16 11:18:16 (GMT)
committerGitHub <noreply@github.com>2022-02-16 11:18:16 (GMT)
commita657bff34945e40be24cd75d02560a93b7623cf5 (patch)
treeb2e076d63d447c3a735844a692ea645105d15186 /Parser/pegen/parse_string.c
parentc292118ef3528df85a9d76ad21029009b560b088 (diff)
downloadcpython-a657bff34945e40be24cd75d02560a93b7623cf5.zip
cpython-a657bff34945e40be24cd75d02560a93b7623cf5.tar.gz
cpython-a657bff34945e40be24cd75d02560a93b7623cf5.tar.bz2
bpo-46762: Fix an assert failure in f-strings where > or < is the last character if the f-string is missing a trailing right brace. (GH-31365)
(cherry picked from commit ffd9f8ff84ed53c956b16d027f7d2926ea631051) Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
Diffstat (limited to 'Parser/pegen/parse_string.c')
-rw-r--r--Parser/pegen/parse_string.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/Parser/pegen/parse_string.c b/Parser/pegen/parse_string.c
index af350b3..15a132b 100644
--- a/Parser/pegen/parse_string.c
+++ b/Parser/pegen/parse_string.c
@@ -668,12 +668,12 @@ fstring_find_expr(Parser *p, const char **str, const char *end, int raw, int rec
*str += 1;
continue;
}
- /* Don't get out of the loop for these, if they're single
- chars (not part of 2-char tokens). If by themselves, they
- don't end an expression (unlike say '!'). */
- if (ch == '>' || ch == '<') {
- continue;
- }
+ }
+ /* Don't get out of the loop for these, if they're single
+ chars (not part of 2-char tokens). If by themselves, they
+ don't end an expression (unlike say '!'). */
+ if (ch == '>' || ch == '<') {
+ continue;
}
/* Normal way out of this loop. */
@@ -700,10 +700,10 @@ fstring_find_expr(Parser *p, const char **str, const char *end, int raw, int rec
}
}
expr_end = *str;
- /* If we leave this loop in a string or with mismatched parens, we
- don't care. We'll get a syntax error when compiling the
- expression. But, we can produce a better error message, so
- let's just do that.*/
+ /* If we leave the above loop in a string or with mismatched parens, we
+ don't really care. We'll get a syntax error when compiling the
+ expression. But, we can produce a better error message, so let's just
+ do that.*/
if (quote_char) {
RAISE_SYNTAX_ERROR("f-string: unterminated string");
goto error;