Commit 1ae99fe1 authored by Stefan Behnel's avatar Stefan Behnel

add test for empty try-finally

parent 118a6fb3
# mode: run
# tag: tryfinally
cimport cython
def finally_except():
"""
>>> try:
......@@ -128,3 +130,34 @@ def try_break():
break
except:
break
def empty_try():
"""
>>> empty_try()
1
"""
try:
pass
finally:
return 1
def empty_try_in_except_raise(raise_in_finally):
"""
>>> empty_try_in_except_raise(False)
Traceback (most recent call last):
ValueError: HUHU
>>> empty_try_in_except_raise(True)
Traceback (most recent call last):
TypeError: OLA
"""
try:
raise ValueError("HUHU")
except ValueError:
try:
pass
finally:
if raise_in_finally:
raise TypeError('OLA')
raise
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment