CodeQL library for Python
codeql/python-all 0.11.15-dev (changelog, source)
Search

Predicate MethodCalls::fromSuper

Holds if call is a call to a method target, derived from a use of super, either as:

(1) super(SomeClass, obj), where the first argument is a reference to the class classUsedInSuper, and the second argument is self.

(2) super(). This implicit version can only happen within a method in a class. The implicit first argument is the class the call happens within classUsedInSuper. The implicit second argument is the self/cls parameter of the method this happens within.

The method call is found by making an attribute read attr with the name functionName on the return value from the super call.

Import path

import semmle.python.dataflow.new.internal.DataFlowDispatch
predicate fromSuper(CallNode call, Function target, string functionName, Class classUsedInSuper, AttrRead attr, Node self)