mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-94996: Disallow lambda pos only params with feature_version < (3, 8) (GH-95934)
This commit is contained in:
parent
b5e3ea2862
commit
a965db37f2
3 changed files with 11 additions and 4 deletions
|
@ -746,6 +746,13 @@ class AST_Tests(unittest.TestCase):
|
|||
with self.assertRaises(SyntaxError):
|
||||
ast.parse('def bar(x=1, /): ...', feature_version=(3, 7))
|
||||
|
||||
ast.parse('lambda x, /: ...', feature_version=(3, 8))
|
||||
ast.parse('lambda x=1, /: ...', feature_version=(3, 8))
|
||||
with self.assertRaises(SyntaxError):
|
||||
ast.parse('lambda x, /: ...', feature_version=(3, 7))
|
||||
with self.assertRaises(SyntaxError):
|
||||
ast.parse('lambda x=1, /: ...', feature_version=(3, 7))
|
||||
|
||||
def test_parenthesized_with_feature_version(self):
|
||||
ast.parse('with (CtxManager() as example): ...', feature_version=(3, 10))
|
||||
# While advertised as a feature in Python 3.10, this was allowed starting 3.9
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue