mirror of
https://github.com/davidhalter/parso.git
synced 2026-08-01 05:30:38 +08:00
Do not treat a walrus argument as a keyword argument (#242)
Build / lint (push) Waiting to run
Build / test (false, 3.10) (push) Waiting to run
Build / test (false, 3.11) (push) Waiting to run
Build / test (false, 3.12) (push) Waiting to run
Build / test (false, 3.13) (push) Waiting to run
Build / test (false, 3.8) (push) Waiting to run
Build / test (false, 3.9) (push) Waiting to run
Build / coverage (push) Waiting to run
Build / lint (push) Waiting to run
Build / test (false, 3.10) (push) Waiting to run
Build / test (false, 3.11) (push) Waiting to run
Build / test (false, 3.12) (push) Waiting to run
Build / test (false, 3.13) (push) Waiting to run
Build / test (false, 3.8) (push) Waiting to run
Build / test (false, 3.9) (push) Waiting to run
Build / coverage (push) Waiting to run
Closes #212
This commit is contained in:
@@ -936,6 +936,9 @@ class _ArglistRule(SyntaxRule):
|
||||
self.add_issue(argument, message=message)
|
||||
else:
|
||||
kw_unpacking_only = True
|
||||
elif argument.children[1] == ':=':
|
||||
# f(a := 1) is a positional argument, not a keyword one.
|
||||
pass
|
||||
else: # Is a keyword argument.
|
||||
kw_only = True
|
||||
if first.type == 'name':
|
||||
|
||||
@@ -366,6 +366,8 @@ def test_valid_fstrings(code):
|
||||
'a[(b:=0)]',
|
||||
'a[(b:=0, c:=0)]',
|
||||
'a[(b:=0):1:2]',
|
||||
'f(a := 1, b)',
|
||||
'f(a := 1, b, c := 2)',
|
||||
]
|
||||
)
|
||||
def test_valid_namedexpr(code):
|
||||
|
||||
Reference in New Issue
Block a user