mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Python: Fix test issues
Fixes the test failures that arose from making `ExtractedArgumentNode` local. For the consistency checks, we now explicitly exclude the `ExtractedArgumentNode`s (now much more plentiful due to the overapproximation) that don't have a corresponding `getCallArg` tuple. For various queries/tests using `instanceof ArgumentNode`, we instead us `isArgumentNode`, which explicitly filters out the ones for which `isArgumentOf` doesn't hold (which, again, is the case for most of the nodes in the overapproximation).
This commit is contained in:
@@ -26,6 +26,8 @@ private module Input implements InputSig<Location, PythonDataFlow> {
|
||||
or
|
||||
// TODO: Implement post-updates for **kwargs, see tests added in https://github.com/github/codeql/pull/14936
|
||||
exists(ArgumentPosition apos | n.argumentOf(_, apos) and apos.isDictSplat())
|
||||
or
|
||||
missingArgumentCallExclude(n)
|
||||
}
|
||||
|
||||
predicate reverseReadExclude(Node n) {
|
||||
@@ -134,6 +136,14 @@ private module Input implements InputSig<Location, PythonDataFlow> {
|
||||
other.getNode().getScope() = f
|
||||
)
|
||||
}
|
||||
|
||||
predicate missingArgumentCallExclude(ArgumentNode arg) {
|
||||
// We overapproximate the argument nodes in order to not rely on the global `getCallArg`
|
||||
// predicate.
|
||||
// Because of this, we must exclude the cases where we have an approximation but no actual
|
||||
// argument node.
|
||||
arg = getCallArgApproximation() and not getCallArg(_, _, _, arg, _)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeConsistency<Location, PythonDataFlow, PythonTaintTracking, Input>
|
||||
|
||||
Reference in New Issue
Block a user