Modify async for test to avoid known try-except problem with trailing unnecessary continue
when the try-except is not followed by any other statements.
Add an xfail test to capture this failing scenario.
This commit is contained in:
Binary file not shown.
@@ -63,6 +63,8 @@ async def tryBlocks():
|
||||
STUFF
|
||||
except MyException:
|
||||
running = False
|
||||
BLOCK_AFTER
|
||||
|
||||
except MyException2:
|
||||
OUTEREXCEPT
|
||||
|
||||
|
20
tests/input/loop_try_except.py
Normal file
20
tests/input/loop_try_except.py
Normal file
@@ -0,0 +1,20 @@
|
||||
async def myFunc():
|
||||
async for b in c:
|
||||
try:
|
||||
STUFF
|
||||
except MyException:
|
||||
running = False
|
||||
|
||||
for b in c:
|
||||
stuff
|
||||
try:
|
||||
STUFF
|
||||
except MyException:
|
||||
running = False
|
||||
|
||||
while a:
|
||||
stuff
|
||||
try:
|
||||
STUFF
|
||||
except MyException:
|
||||
running = False
|
@@ -107,12 +107,11 @@ try : <EOL>
|
||||
<INDENT>
|
||||
STUFF <EOL>
|
||||
<OUTDENT>
|
||||
continue <EOL>
|
||||
except MyException : <EOL>
|
||||
<INDENT>
|
||||
running = False <EOL>
|
||||
continue <EOL>
|
||||
<OUTDENT>
|
||||
BLOCK_AFTER <EOL>
|
||||
<OUTDENT>
|
||||
<OUTDENT>
|
||||
except MyException2 : <EOL>
|
||||
|
36
tests/tokenized/loop_try_except.txt
Normal file
36
tests/tokenized/loop_try_except.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
async def myFunc ( ) : <EOL>
|
||||
<INDENT>
|
||||
async for b in c : <EOL>
|
||||
<INDENT>
|
||||
try : <EOL>
|
||||
<INDENT>
|
||||
STUFF <EOL>
|
||||
<OUTDENT>
|
||||
except MyException : <EOL>
|
||||
<INDENT>
|
||||
running = False <EOL>
|
||||
<OUTDENT>
|
||||
<OUTDENT>
|
||||
<OUTDENT>
|
||||
for b in c : <EOL>
|
||||
<INDENT>
|
||||
stuff <EOL>
|
||||
try : <EOL>
|
||||
<INDENT>
|
||||
STUFF <EOL>
|
||||
<OUTDENT>
|
||||
except MyException : <EOL>
|
||||
<INDENT>
|
||||
running = False <EOL>
|
||||
<OUTDENT>
|
||||
<OUTDENT>
|
||||
while a : <EOL>
|
||||
<INDENT>
|
||||
stuff <EOL>
|
||||
try : <EOL>
|
||||
<INDENT>
|
||||
STUFF <EOL>
|
||||
<OUTDENT>
|
||||
except MyException : <EOL>
|
||||
<INDENT>
|
||||
running = False <EOL>
|
BIN
tests/xfail/loop_try_except.3.7.pyc
Normal file
BIN
tests/xfail/loop_try_except.3.7.pyc
Normal file
Binary file not shown.
Reference in New Issue
Block a user