mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Allow 'continue' inside 'try' clause
SF patch 102989 by Thomas Wouters
This commit is contained in:
parent
1bbc048310
commit
3faa52ecc4
9 changed files with 74 additions and 45 deletions
|
|
@ -349,6 +349,25 @@ print 'continue_stmt' # 'continue'
|
|||
i = 1
|
||||
while i: i = 0; continue
|
||||
|
||||
msg = ""
|
||||
while not msg:
|
||||
msg = "continue + try/except ok"
|
||||
try:
|
||||
continue
|
||||
msg = "continue failed to continue inside try"
|
||||
except:
|
||||
msg = "continue inside try called except block"
|
||||
print msg
|
||||
|
||||
msg = ""
|
||||
while not msg:
|
||||
msg = "finally block not called"
|
||||
try:
|
||||
continue
|
||||
finally:
|
||||
msg = "continue + try/finally ok"
|
||||
print msg
|
||||
|
||||
print 'return_stmt' # 'return' [testlist]
|
||||
def g1(): return
|
||||
def g2(): return 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue