diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2022-09-05 16:54:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-05 16:54:09 (GMT) |
commit | 2c7d2e8d46164efb6e27a64081d8e949f6876515 (patch) | |
tree | 20cdb1ece49de9a14c731c62ab31dcab7929da09 /Lib | |
parent | a9d58feccfd956dc99195af6872b06446738d7db (diff) | |
download | cpython-2c7d2e8d46164efb6e27a64081d8e949f6876515.zip cpython-2c7d2e8d46164efb6e27a64081d8e949f6876515.tar.gz cpython-2c7d2e8d46164efb6e27a64081d8e949f6876515.tar.bz2 |
gh-96587: Raise `SyntaxError` for PEP654 on older `feature_version` (#96588)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_ast.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 68617b1..c97d161 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -771,6 +771,15 @@ class AST_Tests(unittest.TestCase): with self.assertRaises(SyntaxError): ast.parse('(x := 0)', feature_version=(3, 7)) + def test_exception_groups_feature_version(self): + code = dedent(''' + try: ... + except* Exception: ... + ''') + ast.parse(code) + with self.assertRaises(SyntaxError): + ast.parse(code, feature_version=(3, 10)) + def test_invalid_major_feature_version(self): with self.assertRaises(ValueError): ast.parse('pass', feature_version=(2, 7)) |