Skip to content

Commit e9859ad

Browse files
committed
Python: Fix getArgumentForCall when using keyword arguments
Yikes :|
1 parent acb506d commit e9859ad

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

python/ql/src/semmle/python/objects/ObjectAPI.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class CallableValue extends Value {
363363
or
364364
exists(string name |
365365
call.getArgByName(name) = result and
366-
this.(PythonFunctionObjectInternal).getScope().getArg(n + offset).getName() = name
366+
this.(PythonFunctionObjectInternal).getScope().getArg(n).getName() = name
367367
)
368368
or
369369
called instanceof BoundMethodObjectInternal and

python/ql/test/library-tests/PointsTo/calls/getArgumentForCall.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
| 40 | ControlFlowNode for f() | Function f | 0 | ControlFlowNode for IntegerLiteral |
2020
| 40 | ControlFlowNode for f() | Function f | 1 | ControlFlowNode for IntegerLiteral |
2121
| 40 | ControlFlowNode for f() | Function f | 2 | ControlFlowNode for IntegerLiteral |
22-
| 42 | ControlFlowNode for Attribute() | Function C.n | 0 | ControlFlowNode for IntegerLiteral |
2322
| 42 | ControlFlowNode for Attribute() | Function C.n | 0 | ControlFlowNode for c |
23+
| 42 | ControlFlowNode for Attribute() | Function C.n | 1 | ControlFlowNode for IntegerLiteral |

0 commit comments

Comments
 (0)