Skip to content

Commit

Permalink
test exception escape
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz committed Dec 30, 2014
1 parent fbd8c95 commit ab98796
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test_exception_escape.py
@@ -0,0 +1,25 @@
#!/usr/bin/env python3

i = 0

def func():
global i
i += 1
if i == 1: return
if i == 2: raise Exception
if i == 3: raise KeyboardInterrupt

def test():
try:
func()
except Exception:
pass
except KeyboardInterrupt:
return
finally:
print("Finally %i" % i)

test()
test()
test()

0 comments on commit ab98796

Please sign in to comment.