mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
python: add example showing FP
This commit is contained in:
@@ -11,4 +11,5 @@
|
||||
| UninitializedLocal.py:163:7:163:7 | x | Local variable 'x' may be used before it is initialized. |
|
||||
| UninitializedLocal.py:176:16:176:16 | x | Local variable 'x' may be used before it is initialized. |
|
||||
| UninitializedLocal.py:178:16:178:16 | y | Local variable 'y' may be used before it is initialized. |
|
||||
| captured.py:8:15:8:17 | foo | Local variable 'foo' may be used before it is initialized. |
|
||||
| odasa3987.py:11:8:11:10 | var | Local variable 'var' may be used before it is initialized. |
|
||||
|
||||
14
python/ql/test/query-tests/Variables/undefined/captured.py
Normal file
14
python/ql/test/query-tests/Variables/undefined/captured.py
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
def topLevel():
|
||||
foo = 3
|
||||
|
||||
def bar():
|
||||
nonlocal foo
|
||||
print(foo) # FP
|
||||
foo = 4
|
||||
|
||||
bar()
|
||||
print(foo)
|
||||
|
||||
topLevel()
|
||||
Reference in New Issue
Block a user