summaryrefslogtreecommitdiff
path: root/puzzles/20_try_except_finally.py
diff options
context:
space:
mode:
Diffstat (limited to 'puzzles/20_try_except_finally.py')
-rw-r--r--puzzles/20_try_except_finally.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/puzzles/20_try_except_finally.py b/puzzles/20_try_except_finally.py
new file mode 100644
index 0000000..d63ab10
--- /dev/null
+++ b/puzzles/20_try_except_finally.py
@@ -0,0 +1,8 @@
+def foo() -> None:
+ file = None
+ try:
+ file = open('test.json')
+ except Exception:
+ return None
+ finally:
+ file.name # error