提交 430efb04 编写于 作者: D Damien George

tests/basics: Add test for use of return within try-except.

The case of a return statement in the try suite of a try-except statement
was previously only tested by builtin_compile.py, and only then in the part
of this test which checked for the existence of the compile builtin.  So
this patch adds an explicit unit test for this case.
上级 bc365213
# test use of return with try-except
def f(l, i):
try:
return l[i]
except IndexError:
print('IndexError')
return -1
print(f([1], 0))
print(f([], 0))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册