Skip to content

Commit a311582

Browse files
committed
Python: Bring back (now simplified) exclusion
1 parent 4b89a41 commit a311582

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

python/ql/consistency-queries/DataFlowConsistency.ql

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ private module Input implements InputSig<PythonDataFlow> {
4646
)
4747
}
4848

49+
predicate uniqueEnclosingCallableExclude(Node n) {
50+
// We only have a selection of valid callables.
51+
// For instance, we do not have classes as `DataFlowCallable`s.
52+
not n.(SynthCaptureNode).getSynthesizedCaptureNode().getEnclosingCallable() instanceof Function and
53+
not n.(SynthCaptureNode).getSynthesizedCaptureNode().getEnclosingCallable() instanceof Module
54+
}
55+
4956
predicate uniqueCallEnclosingCallableExclude(DataFlowCall call) {
5057
not exists(call.getLocation().getFile().getRelativePath())
5158
}
@@ -125,7 +132,7 @@ private module Input implements InputSig<PythonDataFlow> {
125132
or
126133
// The capture argument node will be reused for every call to the same callable.
127134
arg = call.getArgument(_) and
128-
arg instanceof CaptureArgumentNode
135+
arg instanceof SynthCaptureArgumentNode
129136
}
130137
}
131138

0 commit comments

Comments
 (0)