Skip to content

Commit 0f89f69

Browse files
committed
Python: fix VariableWrite and remove unneded step
1 parent d039ceb commit 0f89f69

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

Diff for: python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll

-8
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,6 @@ module LocalFlow {
300300
nodeTo.(CfgNode).getNode() = def.getDefiningNode()
301301
)
302302
or
303-
// Assignment to captured variables
304-
// These are not covered by the `AssignmentDefinition`s in the case above,
305-
// as they are not necessarily live.
306-
nodeFrom.(CfgNode).getNode() = nodeTo.(CfgNode).getNode().(DefinitionNode).getValue() and
307-
nodeTo.asExpr() = any(VariableCapture::CapturedVariable c).getAStore() and
308-
// Exclude assignments to parameters. These are from default values and not local.
309-
not nodeTo instanceof ParameterNode
310-
or
311303
// With definition
312304
// `with f(42) as x:`
313305
// nodeFrom is `f(42)`

Diff for: python/ql/lib/semmle/python/dataflow/new/internal/VariableCapture.qll

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private module CaptureInput implements Shared::InputSig<Location> {
7272
class VariableWrite extends ControlFlowNode {
7373
CapturedVariable v;
7474

75-
VariableWrite() { this = v.getAStore().getAFlowNode() }
75+
VariableWrite() { this = v.getAStore().getAFlowNode().(DefinitionNode).getValue() }
7676

7777
CapturedVariable getVariable() { result = v }
7878

0 commit comments

Comments
 (0)