mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-40334: Error message for invalid default args in function call (GH-19973)
When parsing something like `f(g()=2)`, where the name of a default arg is not a NAME, but an arbitrary expression, a specialised error message is emitted.
This commit is contained in:
parent
2f37c355ab
commit
4638c64295
4 changed files with 222 additions and 159 deletions
|
@ -609,6 +609,9 @@ FAIL_SPECIALIZED_MESSAGE_CASES = [
|
|||
("lambda *: pass", "named arguments must follow bare *"),
|
||||
("lambda *,: pass", "named arguments must follow bare *"),
|
||||
("lambda *, **a: pass", "named arguments must follow bare *"),
|
||||
("f(g()=2", "expression cannot contain assignment, perhaps you meant \"==\"?"),
|
||||
("f(a, b, *c, d.e=2", "expression cannot contain assignment, perhaps you meant \"==\"?"),
|
||||
("f(*a, **b, c=0, d[1]=3)", "expression cannot contain assignment, perhaps you meant \"==\"?"),
|
||||
]
|
||||
|
||||
GOOD_BUT_FAIL_TEST_CASES = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue