mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
Fix unbound local variable after exception inside with statement (PY-13919)
Change control flow to make it more correct for with statement. Handle special case for Unbound local variable inspection and add tests
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
|
||||
with context_manager:
|
||||
if c:
|
||||
raise ValueError
|
||||
val = c
|
||||
|
||||
print(val)
|
||||
@@ -0,0 +1,15 @@
|
||||
0(1) element: null
|
||||
1(2) element: PyWithStatement
|
||||
2(3) READ ACCESS: context_manager
|
||||
3(4) element: PyIfStatement
|
||||
4(5,9) READ ACCESS: c
|
||||
5(6) element: PyStatementList. Condition: c:true
|
||||
6(7) ASSERTTYPE ACCESS: c
|
||||
7(8) element: PyRaiseStatement
|
||||
8(12,14) READ ACCESS: ValueError
|
||||
9(10) element: PyAssignmentStatement
|
||||
10(11) READ ACCESS: c
|
||||
11(12) WRITE ACCESS: val
|
||||
12(13) element: PyPrintStatement
|
||||
13(14) READ ACCESS: val
|
||||
14() element: null
|
||||
Reference in New Issue
Block a user