mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Python: ObjectAPI to ValueAPI: Makes isAbstract a predicate in CallArgs
This commit is contained in:
@@ -255,3 +255,7 @@ predicate overridden_call(FunctionValue func, FunctionValue overriding, Call cal
|
||||
overriding.getACall().getNode() = call
|
||||
}
|
||||
|
||||
/** Holds if `func` will raise a `NotImplemented` error. */
|
||||
predicate isAbstract(FunctionValue func) {
|
||||
func.getARaisedType() = ClassValue::notImplementedError()
|
||||
}
|
||||
@@ -21,7 +21,7 @@ where
|
||||
or
|
||||
too_few_args(call, func, limit) and too = "too few arguments" and should = "no fewer than "
|
||||
) and
|
||||
not func.isAbstract() and
|
||||
not isAbstract(func) and
|
||||
not exists(FunctionValue overridden | func.overrides(overridden) and correct_args_if_called_as_method(call, overridden))
|
||||
/* The semantics of `__new__` can be a bit subtle, so we simply exclude `__new__` methods */
|
||||
and not func.getName() = "__new__"
|
||||
|
||||
Reference in New Issue
Block a user