Python: Add globals() == locals() test

This commit is contained in:
Rasmus Wriedt Larsen
2021-09-13 20:02:08 +02:00
parent ba7cdec2ea
commit 69fe2a36e5
2 changed files with 5 additions and 4 deletions

View File

@@ -3,3 +3,4 @@
| test.py:101:5:101:14 | Attribute() | Modification of the locals() dictionary will have no effect on the local variables. |
| test.py:102:9:102:14 | Subscript | Modification of the locals() dictionary will have no effect on the local variables. |
| test.py:103:5:103:13 | Attribute() | Modification of the locals() dictionary will have no effect on the local variables. |
| test.py:110:1:110:15 | Subscript | Modification of the locals() dictionary will have no effect on the local variables. |

View File

@@ -104,10 +104,10 @@ def modification_of_locals():
return x
globals()['foo'] = 42 # OK
# in module-level scope `locals() == globals()`
# FP report from https://github.com/github/codeql/issues/6674
locals()['foo'] = 43 # technically OK
#C-style things