Skip to content

Commit bdbdcf8

Browse files
Clean up charpred of WithStatement + fix a comment
1 parent 3707f10 commit bdbdcf8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

python/ql/src/Resources/FileNotAlwaysClosedQuery.qll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,12 @@ class OsCloseCall extends FileClose {
7272

7373
/** A `with` statement. */
7474
class WithStatement extends FileClose {
75-
With w;
76-
77-
WithStatement() { this.asExpr() = w.getContextExpr() }
75+
WithStatement() { this.asExpr() = any(With w).getContextExpr() }
7876
}
7977

8078
/** Holds if an exception may be raised at `raises` if `file` is a file object. */
8179
private predicate mayRaiseWithFile(DataFlow::CfgNode file, DataFlow::CfgNode raises) {
82-
// Currently just consider any method called on `node`; e.g. `file.write()`; as potentially raising an exception
80+
// Currently just consider any method called on `file`; e.g. `file.write()`; as potentially raising an exception
8381
raises.(DataFlow::MethodCallNode).getObject() = file and
8482
not file instanceof FileOpen and
8583
not file instanceof FileClose

0 commit comments

Comments
 (0)