Skip to content

Commit 741317b

Browse files
committed
Python: ObjectAPI to ValueAPI: Makes isAbstract a predicate in CallArgs
1 parent 85eb43d commit 741317b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

python/ql/src/Expressions/CallArgs.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,3 +255,7 @@ predicate overridden_call(FunctionValue func, FunctionValue overriding, Call cal
255255
overriding.getACall().getNode() = call
256256
}
257257

258+
/** Holds if `func` will raise a `NotImplemented` error. */
259+
predicate isAbstract(FunctionValue func) {
260+
func.getARaisedType() = ClassValue::notImplementedError()
261+
}

python/ql/src/Expressions/WrongNumberArgumentsInCall.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ where
2121
or
2222
too_few_args(call, func, limit) and too = "too few arguments" and should = "no fewer than "
2323
) and
24-
not func.isAbstract() and
24+
not isAbstract(func) and
2525
not exists(FunctionValue overridden | func.overrides(overridden) and correct_args_if_called_as_method(call, overridden))
2626
/* The semantics of `__new__` can be a bit subtle, so we simply exclude `__new__` methods */
2727
and not func.getName() = "__new__"

0 commit comments

Comments
 (0)