Skip to content

Commit b6272b3

Browse files
committed
Python: Allow non-unique parameter positions for normal parameters
1 parent a6fd5b6 commit b6272b3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

python/ql/test/experimental/dataflow/TestUtil/DataFlowConsistency.qll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import python
12
import semmle.python.dataflow.new.DataFlow::DataFlow
23
import semmle.python.dataflow.new.internal.DataFlowPrivate
34
import semmle.python.dataflow.new.internal.DataFlowImplConsistency::Consistency
@@ -18,4 +19,20 @@ private class MyConsistencyConfiguration extends ConsistencyConfiguration {
1819
// being a post-update node for the synthetic `**kwargs` parameter.
1920
n instanceof SynthDictSplatParameterNode
2021
}
22+
23+
override predicate uniqueParameterNodePositionExclude(
24+
DataFlowCallable c, ParameterPosition pos, Node p
25+
) {
26+
// For normal parameters that can both be passed as positional arguments or keyword
27+
// arguments, we currently have parameter positions for both cases..
28+
//
29+
// TODO: Figure out how bad breaking this consistency check is
30+
exists(Function func, Parameter param |
31+
c.getScope() = func and
32+
p = parameterNode(param) and
33+
c.getParameter(pos) = p and
34+
param = func.getArg(_) and
35+
param = func.getArgByName(_)
36+
)
37+
}
2138
}

0 commit comments

Comments
 (0)