Skip to content

Commit 69fe2a3

Browse files
committed
Python: Add globals() == locals() test
1 parent ba7cdec commit 69fe2a3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

python/ql/test/query-tests/Statements/general/ModificationOfLocals.expected

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
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. |

python/ql/test/query-tests/Statements/general/test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ def modification_of_locals():
104104
return x
105105

106106

107-
108-
109-
110-
107+
globals()['foo'] = 42 # OK
108+
# in module-level scope `locals() == globals()`
109+
# FP report from https://github.com/github/codeql/issues/6674
110+
locals()['foo'] = 43 # technically OK
111111

112112

113113
#C-style things

0 commit comments

Comments
 (0)