mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
[3.11] gh-94996: Disallow lambda pos only params with feature_version < (3, 8) (GH-95934) (GH-95936)
(cherry picked from commit a965db37f2
)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Automerge-Triggered-By: GH:lysnikolaou
This commit is contained in:
parent
6fc90c1183
commit
7fc8221794
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