Skip to content

Commit a68c928

Browse files
committed
Python: add consistency exclusion
1 parent 5a87e79 commit a68c928

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplConsistency.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ private module Input implements InputSig<PythonDataFlow> {
4040
)
4141
}
4242

43+
predicate uniqueEnclosingCallableExclude(Node n) {
44+
// `CaptureNode`s miss enclosing calables in some cases.
45+
exists(Function func |
46+
func = n.(CaptureNode).getSynthesizedCaptureNode().getEnclosingCallable()
47+
|
48+
// This can happen if `func` is a comprehension.
49+
// In that case, there is no associated DataFlowCallable.
50+
not exists(func.getDefinition())
51+
)
52+
}
53+
4354
predicate uniqueCallEnclosingCallableExclude(DataFlowCall call) {
4455
not exists(call.getLocation().getFile().getRelativePath())
4556
}

0 commit comments

Comments
 (0)