Skip to content

Commit 19ccb05

Browse files
committed
Python: fix inconsistencies
1 parent fa89d56 commit 19ccb05

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,15 +460,21 @@ module VariableCapture {
460460
}
461461

462462
class ClosureExpr extends Expr {
463-
ClosureExpr() { this.getNode() instanceof CallableExpr }
463+
ClosureExpr() {
464+
this.getNode() instanceof CallableExpr
465+
or
466+
this.getNode() instanceof Comp
467+
}
464468

465-
predicate hasBody(Callable body) { body = this.getNode().(CallableExpr).getInnerScope() }
469+
predicate hasBody(Callable body) {
470+
body = this.getNode().(CallableExpr).getInnerScope()
471+
or
472+
body = this.getNode().(Comp).getFunction()
473+
}
466474

467475
predicate hasAliasedAccess(Expr f) { closureFlowStep+(this, f) and not closureFlowStep(f, _) }
468476
}
469477

470-
// TODO: Some basic blocks will not have an enclosing callable
471-
// as their scope are not `Function`s. This leads to inconsistency failures.
472478
class Callable extends Scope {
473479
predicate isConstructor() { none() }
474480
}

0 commit comments

Comments
 (0)