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
Gwenaël Samain
cython
Commits
5f6667c7
Commit
5f6667c7
authored
May 24, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make tests compatible with py3k
parent
0da93240
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
15 deletions
+8
-15
tests/run/with_gil.pyx
tests/run/with_gil.pyx
+8
-15
No files found.
tests/run/with_gil.pyx
View file @
5f6667c7
...
...
@@ -5,7 +5,7 @@ Test the 'with gil:' statement.
cimport
cython
#from libc.stdio cimport printf, puts
from
cpython
.ref
cimport
PyObject
,
Py_INCREF
from
cpython
cimport
PyObject
,
Py_INCREF
import
sys
...
...
@@ -22,7 +22,7 @@ cdef void puts(char *string) with gil:
"""
We need this for doctest, used from nogil sections.
"""
print
string
print
string
.
decode
(
'ascii'
)
# Start with some normal Python functions
...
...
@@ -391,25 +391,19 @@ def test_nogil_try_finally_propagate_exception():
def
test_nogil_try_finally_return_in_with_gil
(
x
):
"""
>>> test_nogil_try_finally_return_in_with_gil(10)
(None, None, None)
print me
10
"""
# For some reason, this exception is set, clear it first
# (<type 'exceptions.ImportError'>,
# ImportError('cannot import name _TextTestResult',),
# <traceback object at 0x10073c4d0>)
sys
.
exc_clear
()
with
nogil
:
try
:
with
gil
:
raise
Exception
(
"Swallow me!"
)
finally
:
with
gil
:
print
sys
.
exc_info
()
print
"print me"
return
x
print
"I am not executed"
,
sys
.
exc_info
()
print
"I am not executed"
cdef
void
nogil_try_finally_return
()
nogil
:
try
:
...
...
@@ -417,18 +411,17 @@ cdef void nogil_try_finally_return() nogil:
raise
Exception
(
"I am swallowed in nogil code... right?"
)
finally
:
with
gil
:
print
sys
.
exc_info
()
print
"print me first"
return
with
gil
:
print
"I am not executed"
,
sys
.
exc_info
()
print
"I am not executed"
def
test_nogil_try_finally_return
():
"""
>>> test_nogil_try_finally_return()
(None, None, None)
print me first
"""
sys
.
exc_clear
()
with
nogil
:
nogil_try_finally_return
()
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