mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
bpo-40614: Respect feature version for f-string debug expressions (GH-20196)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
This commit is contained in:
parent
db5aed931f
commit
c116c94ff1
4 changed files with 17 additions and 0 deletions
|
|
@ -928,6 +928,11 @@ fstring_find_expr(Parser *p, const char **str, const char *end, int raw, int rec
|
|||
/* Check for =, which puts the text value of the expression in
|
||||
expr_text. */
|
||||
if (**str == '=') {
|
||||
if (p->feature_version < 8) {
|
||||
RAISE_SYNTAX_ERROR("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