mirror of
https://github.com/python/cpython.git
synced 2025-10-02 21:25:24 +00:00
bpo-40334: Spacialized error message for invalid args after bare '*' (GH-19865)
When parsing things like `def f(*): pass` the old parser used to output `SyntaxError: named arguments must follow bare *`, which the new parser wasn't able to do.
This commit is contained in:
parent
c3f001461d
commit
e10e7c771b
5 changed files with 598 additions and 336 deletions
|
@ -603,6 +603,12 @@ FAIL_SPECIALIZED_MESSAGE_CASES = [
|
|||
("1 += 1", "cannot assign to literal"),
|
||||
("pass\n pass", "unexpected indent"),
|
||||
("def f():\npass", "expected an indented block"),
|
||||
("def f(*): pass", "named arguments must follow bare *"),
|
||||
("def f(*,): pass", "named arguments must follow bare *"),
|
||||
("def f(*, **a): pass", "named arguments must follow bare *"),
|
||||
("lambda *: pass", "named arguments must follow bare *"),
|
||||
("lambda *,: pass", "named arguments must follow bare *"),
|
||||
("lambda *, **a: pass", "named arguments must follow bare *"),
|
||||
]
|
||||
|
||||
GOOD_BUT_FAIL_TEST_CASES = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue