File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
python/ql/lib/semmle/python/essa Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,17 @@ class ModuleVariable extends SsaSourceVariable instanceof GlobalVariable {
276276 override CallNode redefinedAtCallSite ( ) { none ( ) }
277277}
278278
279+ /** Holds if `f` is an import of the form `from .[...] import ...` and the enclosing scope is an __init__ module */
280+ private predicate import_from_dot_in_init ( ImportExprNode f ) {
281+ f .getScope ( ) = any ( Module m ) .getInitModule ( ) and
282+ (
283+ f .getNode ( ) .getLevel ( ) = 1 and
284+ not exists ( f .getNode ( ) .getName ( ) )
285+ or
286+ f .getNode ( ) .getImportedModuleName ( ) = f .getEnclosingModule ( ) .getPackage ( ) .getName ( )
287+ )
288+ }
289+
279290class NonEscapingGlobalVariable extends ModuleVariable {
280291 NonEscapingGlobalVariable ( ) {
281292 this instanceof GlobalVariable and
Original file line number Diff line number Diff line change @@ -7,6 +7,13 @@ import python
77private import semmle.python.internal.CachedStages
88private import LegacyPointsTo
99
10+ /** Hold if `expr` is a test (a branch) and `use` is within that test */
11+ predicate test_contains ( ControlFlowNode expr , ControlFlowNode use ) {
12+ expr .getNode ( ) instanceof Expr and
13+ expr .isBranch ( ) and
14+ expr .getAChild * ( ) = use
15+ }
16+
1017cached
1118module SsaSource {
1219 /** Holds if `v` is used as the receiver in a method call. */
You can’t perform that action at this time.
0 commit comments