mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
[3.9] bpo-40614: Respect feature version for f-string debug expressions (GH-20196) (GH-20464)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
(cherry picked from commit c116c94
)
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
This commit is contained in:
parent
3a2667d91e
commit
9b83829e7d
4 changed files with 17 additions and 0 deletions
|
@ -5069,6 +5069,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue