Skip to content

Commit e050f2e

Browse files
committed
Python: Adjust subclass finder to no ESSA nodes
But the new test results looks very strange indeed!
1 parent 60b784a commit e050f2e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

python/ql/lib/semmle/python/frameworks/internal/SubclassFinder.qll

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,7 @@ module NotExposed {
199199
relevantClass = newOrExistingModeling(spec).getASubclass*() and
200200
ImportResolution::module_export(mod, relevantName, def) and
201201
value = relevantClass.getAValueReachableFromSource().asCfgNode() and
202-
(
203-
value = def.asVar().getDefinition().(AssignmentDefinition).getValue()
204-
or
205-
value = def.asCfgNode()
206-
)
202+
value = def.asCfgNode()
207203
// value could be a ClassExpr if a new class is defined, or a Name if defining an alias
208204
) and
209205
(

python/ql/test/experimental/library-tests/FindSubclass/Find.expected

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
| Django.Views.View~Subclass | find_subclass_test | Member[ViewAliasInExcept] |
2+
| Django.Views.View~Subclass | find_subclass_test | Member[ViewAliasInTry] |
3+
| Django.Views.View~Subclass | find_subclass_test | Member[__name__] |
4+
| Django.Views.View~Subclass | find_subclass_test | Member[__package__] |
15
| Django.Views.View~Subclass | find_subclass_test | Member[clash2] |
26
| Django.Views.View~Subclass | find_subclass_test | Member[clash3] |
37
| Django.Views.View~Subclass | find_subclass_test | Member[clash] |
@@ -9,6 +13,8 @@
913
| flask.View~Subclass | find_subclass_test | Member[ViewAlias] |
1014
| flask.View~Subclass | find_subclass_test | Member[ViewAlias_no_use] |
1115
| flask.View~Subclass | find_subclass_test | Member[View] |
16+
| flask.View~Subclass | find_subclass_test | Member[__name__] |
17+
| flask.View~Subclass | find_subclass_test | Member[__package__] |
1218
| flask.View~Subclass | find_subclass_test | Member[clash2] |
1319
| flask.View~Subclass | find_subclass_test | Member[clash3] |
1420
| flask.View~Subclass | find_subclass_test | Member[clash] |

0 commit comments

Comments
 (0)