Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
6a08a780
Commit
6a08a780
authored
Dec 08, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runnable test case for try-finally
parent
69211801
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
tests/run/tryfinally.pyx
tests/run/tryfinally.pyx
+61
-0
No files found.
tests/run/tryfinally.pyx
0 → 100644
View file @
6a08a780
u"""
>>> try:
... raise ValueError
... finally:
... raise TypeError
Traceback (most recent call last):
TypeError
>>> finally_except()
Traceback (most recent call last):
TypeError
>>> def try_return_py():
... try:
... return 1
... finally:
... return 2
>>> try_return_py()
2
>>> try_return_cy()
2
>>> i=1
>>> for i in range(3):
... try:
... continue
... finally:
... i+=1
>>> i
3
>>> try_continue(3)
3
"""
def
finally_except
():
try
:
raise
ValueError
finally
:
raise
TypeError
def
try_return_cy
():
try
:
return
1
finally
:
return
2
def
try_return_temp
(
a
):
b
=
a
+
2
try
:
c
=
a
+
b
return
c
finally
:
print
b
-
a
def
try_continue
(
a
):
i
=
1
for
i
in
range
(
a
):
try
:
continue
finally
:
i
+=
1
return
i
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment