Skip to content

Commit 9b7a20f

Browse files
committed
python: add example showing FP
1 parent d953ad6 commit 9b7a20f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

python/ql/test/query-tests/Variables/undefined/UninitializedLocal.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
| UninitializedLocal.py:163:7:163:7 | x | Local variable 'x' may be used before it is initialized. |
1212
| UninitializedLocal.py:176:16:176:16 | x | Local variable 'x' may be used before it is initialized. |
1313
| UninitializedLocal.py:178:16:178:16 | y | Local variable 'y' may be used before it is initialized. |
14+
| captured.py:8:15:8:17 | foo | Local variable 'foo' may be used before it is initialized. |
1415
| odasa3987.py:11:8:11:10 | var | Local variable 'var' may be used before it is initialized. |
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/python
2+
3+
def topLevel():
4+
foo = 3
5+
6+
def bar():
7+
nonlocal foo
8+
print(foo) # FP
9+
foo = 4
10+
11+
bar()
12+
print(foo)
13+
14+
topLevel()

0 commit comments

Comments
 (0)