зеркало из https://github.com/github/codeql.git
python: add example showing FP
This commit is contained in:
Родитель
d953ad63fe
Коммит
9b7a20f4ad
|
@ -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. |
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
def topLevel():
|
||||
foo = 3
|
||||
|
||||
def bar():
|
||||
nonlocal foo
|
||||
print(foo) # FP
|
||||
foo = 4
|
||||
|
||||
bar()
|
||||
print(foo)
|
||||
|
||||
topLevel()
|
Загрузка…
Ссылка в новой задаче