diff options
author | Shantanu <hauntsaninja@users.noreply.github.com> | 2020-06-06 10:08:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-06 10:08:48 (GMT) |
commit | f7ed4d4e83f5d9e85e244a1cbc460f26436ab24d (patch) | |
tree | de469bc0aa35508ca96bfaa8dd5e4cda290d925f /Python | |
parent | c067183605cf84bb1a246635f52827251d0476f8 (diff) | |
download | cpython-f7ed4d4e83f5d9e85e244a1cbc460f26436ab24d.zip cpython-f7ed4d4e83f5d9e85e244a1cbc460f26436ab24d.tar.gz cpython-f7ed4d4e83f5d9e85e244a1cbc460f26436ab24d.tar.bz2 |
bpo-40614: Respect feature version for f-string debug expressions (GH-20196) (GH-20466)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
(cherry picked from commit c116c94ff119485761460f1033cdee425bed0310)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/ast.c b/Python/ast.c index f70d48b..594879b 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -5202,6 +5202,12 @@ fstring_find_expr(const char **str, const char *end, int raw, int recurse_lvl, /* Check for =, which puts the text value of the expression in expr_text. */ if (**str == '=') { + if (c->c_feature_version < 8) { + ast_error(c, n, + "f-string: self documenting expressions are " + "only supported in Python 3.8 and greater"); + goto error; + } *str += 1; /* Skip over ASCII whitespace. No need to test for end of string |