summaryrefslogtreecommitdiffstats
path: root/Parser/string_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'Parser/string_parser.c')
-rw-r--r--Parser/string_parser.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Parser/string_parser.c b/Parser/string_parser.c
index fae2a36..65ddd46 100644
--- a/Parser/string_parser.c
+++ b/Parser/string_parser.c
@@ -357,7 +357,12 @@ fstring_compile_expr(Parser *p, const char *expr_start, const char *expr_end,
break;
}
}
+
if (s == expr_end) {
+ if (*expr_end == '!' || *expr_end == ':' || *expr_end == '=') {
+ RAISE_SYNTAX_ERROR("f-string: expression required before '%c'", *expr_end);
+ return NULL;
+ }
RAISE_SYNTAX_ERROR("f-string: empty expression not allowed");
return NULL;
}