aboutsummaryrefslogtreecommitdiff
path: root/tests/basics/try_finally_return.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basics/try_finally_return.py')
-rw-r--r--tests/basics/try_finally_return.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/basics/try_finally_return.py b/tests/basics/try_finally_return.py
new file mode 100644
index 000000000..4adf3f097
--- /dev/null
+++ b/tests/basics/try_finally_return.py
@@ -0,0 +1,23 @@
+def func1():
+ try:
+ return "it worked"
+ finally:
+ print("finally 1")
+
+print(func1())
+
+
+def func2():
+ try:
+ return "it worked"
+ finally:
+ print("finally 2")
+
+def func3():
+ try:
+ s = func2()
+ return s + ", did this work?"
+ finally:
+ print("finally 3")
+
+print(func3())