Python: Expand starargs_only test

This commit is contained in:
Rasmus Wriedt Larsen
2023-01-20 16:34:59 +01:00
parent 0df3dd68d6
commit d9fbe58ad5
2 changed files with 5 additions and 0 deletions

View File

@@ -1085,6 +1085,7 @@ predicate normalCallArg(CallNode call, Node arg, ArgumentPosition apos) {
arg.asCfgNode() = call.getArgByName(name)
)
or
// the first `*args`
exists(int index |
apos.isStarArgs(index) and
arg.asCfgNode() = call.getStarArg() and

View File

@@ -217,6 +217,10 @@ def test_only_starargs():
args = (arg1, arg2, "safe") # $ arg1 arg2 func=starargs_only
starargs_only(*args)
args = (arg1, arg2) # $ arg1 arg2 func=starargs_only
more_args = (arg3, arg4)
starargs_only(*args, *more_args)
def starargs_mixed(a, *args):
SINK1(a)