File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
test/query-tests/Expressions/super Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change 1313 */
1414
1515import python
16+ import semmle.python.dataflow.new.DataFlow
17+ import semmle.python.ApiGraphs
1618
17- from CallNode call_to_super , string name
19+ from DataFlow :: CallCfgNode call_to_super , string name
1820where
19- exists ( GlobalVariable gv , ControlFlowNode cn |
20- call_to_super = ClassValue:: super_ ( ) .getACall ( ) and
21- gv .getId ( ) = "super" and
22- cn = call_to_super .getArg ( 0 ) and
23- name = call_to_super .getScope ( ) .getScope ( ) .( Class ) .getName ( ) and
24- exists ( ClassValue other |
25- cn .pointsTo ( other ) and
26- not other .getScope ( ) .getName ( ) = name
27- )
21+ call_to_super = API:: builtin ( "super" ) .getACall ( ) and
22+ name = call_to_super .getScope ( ) .getScope ( ) .( Class ) .getName ( ) and
23+ exists ( DataFlow:: Node arg |
24+ arg = call_to_super .getArg ( 0 ) and
25+ arg .getALocalSource ( ) .asExpr ( ) .( Name ) .getId ( ) != name
2826 )
2927select call_to_super .getNode ( ) , "First argument to super() should be " + name + "."
Original file line number Diff line number Diff line change 1- | test.py:10:9:10:27 | super() | First argument to super() should be NotMyDict. |
1+ | test.py:10:9:10:27 | ControlFlowNode for super() | First argument to super() should be NotMyDict. |
You can’t perform that action at this time.
0 commit comments