Skip to content

Commit 204e01f

Browse files
committed
change getNumArgument to only count positional arguments
1 parent a5b11e8 commit 204e01f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

python/ql/lib/semmle/python/ApiGraphs.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ module API {
356356
}
357357

358358
/** Gets the number of arguments of this call. Both positional and named arguments are counted. */
359-
int getNumArgument() { result = count([this.getArg(_), this.getArgByName(_)]) }
359+
int getNumArgument() { result = count(this.getArg(_)) }
360360
}
361361

362362
/**

python/ql/test/library-tests/frameworks/data/test.expected

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ isSink
4747
| test.py:86:8:86:60 | ControlFlowNode for Attribute() | test-sink |
4848
| test.py:87:8:87:67 | ControlFlowNode for Attribute() | test-sink |
4949
| test.py:89:21:89:23 | ControlFlowNode for one | test-sink |
50-
| test.py:90:25:90:27 | ControlFlowNode for one | test-sink |
50+
| test.py:91:21:91:23 | ControlFlowNode for one | test-sink |
51+
| test.py:91:30:91:32 | ControlFlowNode for two | test-sink |
5152
| test.py:98:6:98:9 | ControlFlowNode for baz2 | test-sink |
5253
isSource
5354
| test.py:3:5:3:15 | ControlFlowNode for getSource() | test-source |

python/ql/test/library-tests/frameworks/data/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def secondAndAfter(self, arg1, arg2, arg3, arg4, arg5):
8787
mySink(Steps.preserveAllButFirstArgument("foo", "bar", getSource())) # FLOW
8888

8989
CallFilter.arityOne(one) # match
90-
CallFilter.arityOne(one=one) # match
91-
CallFilter.arityOne(one, two=two) # NO match
90+
CallFilter.arityOne(one=one) # NO match
91+
CallFilter.arityOne(one, two=two) # match - on both the named and positional arguments
9292
CallFilter.arityOne(one=one, two=two) # NO match
9393

9494
from foo1.bar import baz1

0 commit comments

Comments
 (0)