File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
test/query-tests/Statements/general Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -30,5 +30,11 @@ predicate modification_of_locals(ControlFlowNode f) {
3030}
3131
3232from AstNode a , ControlFlowNode f
33- where modification_of_locals ( f ) and a = f .getNode ( )
33+ where
34+ modification_of_locals ( f ) and
35+ a = f .getNode ( ) and
36+ // in module level scope `locals() == globals()`
37+ // see https://docs.python.org/3/library/functions.html#locals
38+ // FP report in https://github.com/github/codeql/issues/6674
39+ not a .getScope ( ) instanceof ModuleScope
3440select a , "Modification of the locals() dictionary will have no effect on the local variables."
Original file line number Diff line number Diff line change 33| test.py:101:5:101:14 | Attribute() | Modification of the locals() dictionary will have no effect on the local variables. |
44| test.py:102:9:102:14 | Subscript | Modification of the locals() dictionary will have no effect on the local variables. |
55| test.py:103:5:103:13 | Attribute() | Modification of the locals() dictionary will have no effect on the local variables. |
6- | test.py:110:1:110:15 | Subscript | Modification of the locals() dictionary will have no effect on the local variables. |
You can’t perform that action at this time.
0 commit comments