Python: do not stake out too much territory

This commit is contained in:
Rasmus Lerchedahl Petersen
2022-09-14 10:28:11 +02:00
parent 58cfac27d2
commit f83158ff8b
2 changed files with 13 additions and 1 deletions

View File

@@ -617,6 +617,18 @@ class SpecialCall extends DataFlowSourceCall, TSpecialCall {
* and not be available for a summary. * and not be available for a summary.
*/ */
class LibraryCall extends NormalCall { class LibraryCall extends NormalCall {
LibraryCall() {
// TODO: share this with `resolvedCall`
not (
call = any(DataFlowCallableValue cv).getACall()
or
call = any(DataFlowLambda l).getACall()
or
// TODO: this should be covered by `DataFlowCallableValue`, but a `ClassValue` is not a `CallableValue`.
call = any(ClassValue c).getACall()
)
}
// TODO: Implement Python calling convention? // TODO: Implement Python calling convention?
override Node getArg(int n) { result = TCfgNode(call.getArg(n)) } override Node getArg(int n) { result = TCfgNode(call.getArg(n)) }

View File

@@ -32,6 +32,6 @@ try:
# ignored. # ignored.
import mypkg import mypkg
mypkg.foo(42) # $ call=mypkg.foo(..) qlclass=NormalCall mypkg.foo(42) # $ call=mypkg.foo(..) qlclass=NormalCall
mypkg.subpkg.bar(43) # $ call=mypkg.subpkg.bar(..) qlclass=NormalCall mypkg.subpkg.bar(43) # $ call=mypkg.subpkg.bar(..) qlclass=LibraryCall arg_0=43
except: except:
pass pass