Skip to content

Commit 78c484f

Browse files
committed
Python: remove support for capturing callbacks
This will be added in a follow-up PR instead.
1 parent 6e4011d commit 78c484f

File tree

2 files changed

+1
-40
lines changed

2 files changed

+1
-40
lines changed

python/ql/lib/semmle/python/dataflow/new/FlowSummary.qll

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -37,45 +37,6 @@ abstract class SummarizedCallable extends LibraryCallable, Impl::Public::Summari
3737

3838
deprecated class RequiredSummaryComponentStack = Impl::Private::RequiredSummaryComponentStack;
3939

40-
private module LibraryCallbackSummaries {
41-
private predicate libraryCall(CallCfgNode call) {
42-
not exists(NormalCall normalCall | call.getNode() = normalCall.getNode())
43-
}
44-
45-
private DataFlow::LocalSourceNode trackLambdaCreation(TypeTracker t) {
46-
t.start() and
47-
lambdaCreation(result, _, _)
48-
or
49-
exists(TypeTracker t2 | result = trackLambdaCreation(t2).track(t2, t)) and
50-
not result.(ParameterNode).getParameter().isSelf()
51-
}
52-
53-
private predicate libraryCallHasLambdaArg(CallCfgNode call, int i) {
54-
exists(CfgNode arg |
55-
arg = call.getArg(i) and
56-
arg.getALocalSource() = trackLambdaCreation(TypeTracker::end()) and
57-
libraryCall(call)
58-
)
59-
}
60-
61-
private class LibraryLambdaMethod extends SummarizedCallable {
62-
LibraryLambdaMethod() { this = "<library method accepting a callback>" }
63-
64-
final override CallCfgNode getACall() { libraryCallHasLambdaArg(result, _) }
65-
66-
final override ArgumentNode getACallback() { none() }
67-
68-
override predicate propagatesFlow(string input, string output, boolean preservesValue) {
69-
exists(int i |
70-
i in [0 .. 10] and
71-
input = "Argument[" + i + "]" and
72-
output = "Argument[" + i + "].Parameter[lambda-self]"
73-
) and
74-
preservesValue = true
75-
}
76-
}
77-
}
78-
7940
private class SummarizedCallableFromModel extends SummarizedCallable {
8041
string type;
8142
string path;

python/ql/test/experimental/dataflow/variable-capture/test_library_calls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ def set(x):
4545
for x in map(set, [1]):
4646
pass
4747

48-
SINK(captured["x"]) #$ captured
48+
SINK(captured["x"]) #$ MISSING: captured

0 commit comments

Comments
 (0)