File tree 2 files changed +7
-2
lines changed
test/query-tests/Statements/general
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) {
30
30
}
31
31
32
32
from 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
34
40
select a , "Modification of the locals() dictionary will have no effect on the local variables."
Original file line number Diff line number Diff line change 3
3
| test.py:101:5:101:14 | Attribute() | Modification of the locals() dictionary will have no effect on the local variables. |
4
4
| test.py:102:9:102:14 | Subscript | Modification of the locals() dictionary will have no effect on the local variables. |
5
5
| 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