Skip to content

Commit 1a59c9b

Browse files
authored
Merge pull request github#6204 from tausbn/python-ensmallen-localsourcenode
Python: Clean up `LocalSourceNode` charpred
2 parents 1ed027e + a9c1d3b commit 1a59c9b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

python/ql/src/semmle/python/dataflow/new/internal/LocalSources.qll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ private import DataFlowPrivate
3333
class LocalSourceNode extends Node {
3434
cached
3535
LocalSourceNode() {
36-
not simpleLocalFlowStep(_, this) and
37-
// Currently, we create synthetic post-update nodes for
38-
// - arguments to calls that may modify said argument
39-
// - direct reads a writes of object attributes
40-
// Both of these preserve the identity of the underlying pointer, and hence we exclude these as
41-
// local source nodes.
42-
// We do, however, allow the post-update nodes that arise from object creation (which are non-synthetic).
43-
not this instanceof SyntheticPostUpdateNode
36+
this instanceof ExprNode and
37+
not simpleLocalFlowStep(_, this)
4438
or
39+
// Module variable nodes must be local source nodes, otherwise type trackers cannot step through
40+
// them.
41+
this instanceof ModuleVariableNode
42+
or
43+
// We explicitly include any read of a global variable, as some of these may have local flow going
44+
// into them.
4545
this = any(ModuleVariableNode mvn).getARead()
4646
}
4747

0 commit comments

Comments
 (0)