Skip to content

Commit e34a279

Browse files
committed
Python: Remove global restriction on ModuleVariableNode
This may result in more nodes, but it should still be bounded by the number of global variables in the source code.
1 parent a30acfc commit e34a279

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPublic.qll

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,7 @@ newtype TNode =
7676
node.getNode() = any(Comp c).getIterable()
7777
} or
7878
/** A node representing a global (module-level) variable in a specific module. */
79-
TModuleVariableNode(Module m, GlobalVariable v) {
80-
v.getScope() = m and
81-
(
82-
v.escapes()
83-
or
84-
isAccessedThroughImportStar(m) and
85-
ImportStar::globalNameDefinedInModule(v.getId(), m)
86-
)
87-
} or
79+
TModuleVariableNode(Module m, GlobalVariable v) { v.getScope() = m } or
8880
/**
8981
* A synthetic node representing that an iterable sequence flows to consumer.
9082
*/
@@ -470,8 +462,6 @@ class ModuleVariableNode extends Node, TModuleVariableNode {
470462
override Location getLocation() { result = mod.getLocation() }
471463
}
472464

473-
private predicate isAccessedThroughImportStar(Module m) { m = ImportStar::getStarImported(_) }
474-
475465
private ModuleVariableNode import_star_read(Node n) {
476466
resolved_import_star_module(result.getModule(), result.getVariable().getId(), n)
477467
}

0 commit comments

Comments
 (0)