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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
f0cc8c42
Commit
f0cc8c42
authored
Mar 18, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some more tests
parent
c67b206b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
9 deletions
+51
-9
tests/run/with_gil.pyx
tests/run/with_gil.pyx
+51
-9
No files found.
tests/run/with_gil.pyx
View file @
f0cc8c42
...
...
@@ -99,7 +99,7 @@ def test_try_finally_and_outer_except():
"""
>>> test_try_finally_and_outer_except()
First finally clause
Second finally clause
...
Second finally clause
Caught: Some Exception
End of function
"""
...
...
@@ -115,7 +115,7 @@ def test_try_finally_and_outer_except():
finally
:
puts
(
"First finally clause"
)
finally
:
puts
(
"Second finally clause
...
"
)
puts
(
"Second finally clause"
)
puts
(
"This is not executed"
)
except
Exception
,
e
:
...
...
@@ -195,37 +195,79 @@ def test_infer_types():
print
obj
.
some_attribute
def
test_closure
():
"""
>>> test_closure()
Traceback (most recent call last):
...
Exception: {'twinkle': 'little star'}
"""
a
=
dict
(
twinkle
=
'little star'
)
def
inner_function
():
with
nogil
:
with
gil
:
raise
Exception
(
a
)
with
nogil
:
with
gil
:
inner_function
()
raise
Exception
(
"This should not be raised!"
)
cpdef
test_cpdef
():
"""
>>> test_cpdef()
Seems to work!
Or does it?
...
Or does it?
"""
with
nogil
:
with
gil
:
print
"Seems to work!"
puts
(
"Or does it?
...
"
)
puts
(
"Or does it?"
)
# Now test some cdef functions with different return types
cdef
void
void_nogil_ignore_exception
()
nogil
:
with
gil
:
raise
NameError
raise
Exception
(
"This is swallowed"
)
puts
(
"unreachable"
)
with
gil
:
print
"unreachable"
def
test_void_nogil_ignore_exception
():
cdef
void
void_nogil_nested_gil
()
nogil
:
with
gil
:
with
nogil
:
with
gil
:
print
'Inner gil section'
puts
(
"nogil section"
)
raise
Exception
(
"Swallow this"
)
puts
(
"Don't print this"
)
def
test_nogil_void_funcs_with_gil
():
"""
>>> redirect_stderr(test_void_nogil_ignore_exception)
Exception NameError in 'with_gil.void_nogil_ignore_exception' ignored
Exception NameError in 'with_gil.void_nogil_ignore_exception' ignored
>>> redirect_stderr(test_nogil_void_funcs_with_gil)
Exception Exception: Exception('This is swallowed',) in 'with_gil.void_nogil_ignore_exception' ignored
Inner gil section
nogil section
Exception Exception: Exception('Swallow this',) in 'with_gil.void_nogil_nested_gil' ignored
"""
void_nogil_ignore_exception
()
void_nogil_nested_gil
()
def
test_nogil_void_funcs_with_nogil
():
"""
>>> redirect_stderr(test_nogil_void_funcs_with_nogil)
Exception Exception: Exception('This is swallowed',) in 'with_gil.void_nogil_ignore_exception' ignored
Inner gil section
nogil section
Exception Exception: Exception('Swallow this',) in 'with_gil.void_nogil_nested_gil' ignored
"""
with
nogil
:
void_nogil_ignore_exception
()
void_nogil_nested_gil
()
cdef
PyObject
*
nogil_propagate_exception
()
nogil
except
NULL
:
...
...
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