mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Python: Add test of keyword argument with same name as positional-only parameter
This is a bit of an edge case, but allowed. Since we currently don't provide information on positional only arguments, we can't do much to solve it right now.
This commit is contained in:
@@ -204,6 +204,18 @@ def test_mixed():
|
|||||||
mixed(**args)
|
mixed(**args)
|
||||||
|
|
||||||
|
|
||||||
|
def kwargs_same_name_as_positional_only(a, /, **kwargs):
|
||||||
|
SINK1(a)
|
||||||
|
SINK2(kwargs["a"])
|
||||||
|
|
||||||
|
@expects(2*2)
|
||||||
|
def test_kwargs_same_name_as_positional_only():
|
||||||
|
kwargs_same_name_as_positional_only(arg1, a=arg2) # $ arg1 SPURIOUS: bad1="arg2" MISSING: arg2
|
||||||
|
|
||||||
|
kwargs = {"a": arg2} # $ func=kwargs_same_name_as_positional_only SPURIOUS: bad1="arg2" MISSING: arg2
|
||||||
|
kwargs_same_name_as_positional_only(arg1, **kwargs) # $ arg1
|
||||||
|
|
||||||
|
|
||||||
def starargs_only(*args):
|
def starargs_only(*args):
|
||||||
SINK1(args[0])
|
SINK1(args[0])
|
||||||
SINK2(args[1])
|
SINK2(args[1])
|
||||||
|
|||||||
Reference in New Issue
Block a user