mirror of
https://github.com/python/cpython.git
synced 2025-08-19 00:00:48 +00:00
[3.10] gh-94947: Disallow parsing walrus with feature_version < (3, 8) (GH-94948) (#94969)
* gh-94947: Disallow parsing walrus with feature_version < (3, 8)
* oops, commit the parser
* 📜🤖 Added by blurb_it.
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>.
(cherry picked from commit ae0be5a53b
)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
This commit is contained in:
parent
95ae29d508
commit
dda9198021
4 changed files with 10 additions and 2 deletions
|
@ -691,6 +691,11 @@ class AST_Tests(unittest.TestCase):
|
|||
with self.assertRaises(SyntaxError):
|
||||
ast.parse('f"{x=}"', feature_version=(3, 7))
|
||||
|
||||
def test_assignment_expression_feature_version(self):
|
||||
ast.parse('(x := 0)', feature_version=(3, 8))
|
||||
with self.assertRaises(SyntaxError):
|
||||
ast.parse('(x := 0)', feature_version=(3, 7))
|
||||
|
||||
def test_constant_as_name(self):
|
||||
for constant in "True", "False", "None":
|
||||
expr = ast.Expression(ast.Name(constant, ast.Load()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue