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
Xavier Thompson
cython
Commits
237050b4
Commit
237050b4
authored
Aug 20, 2011
by
robertwb
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #56 from markflorisson88/master
Acquire the GIL to build the traceback in nogil functions
parents
359ba798
5de6eb59
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+9
-0
tests/run/nogil.pyx
tests/run/nogil.pyx
+16
-0
No files found.
Cython/Compiler/Nodes.py
View file @
237050b4
...
@@ -1456,7 +1456,16 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -1456,7 +1456,16 @@ class FuncDefNode(StatNode, BlockNode):
# TODO: Fix exception tracing (though currently unused by cProfile).
# TODO: Fix exception tracing (though currently unused by cProfile).
# code.globalstate.use_utility_code(get_exception_tuple_utility_code)
# code.globalstate.use_utility_code(get_exception_tuple_utility_code)
# code.put_trace_exception()
# code.put_trace_exception()
if
lenv
.
nogil
:
code
.
putln
(
"{"
)
code
.
put_ensure_gil
()
code
.
put_add_traceback
(
self
.
entry
.
qualified_name
)
code
.
put_add_traceback
(
self
.
entry
.
qualified_name
)
if
lenv
.
nogil
:
code
.
put_release_ensured_gil
()
code
.
putln
(
"}"
)
else
:
else
:
warning
(
self
.
entry
.
pos
,
"Unraisable exception in function '%s'."
\
warning
(
self
.
entry
.
pos
,
"Unraisable exception in function '%s'."
\
%
self
.
entry
.
qualified_name
,
0
)
%
self
.
entry
.
qualified_name
,
0
)
...
...
tests/run/nogil.pyx
View file @
237050b4
...
@@ -19,3 +19,19 @@ cdef int g(int x) nogil:
...
@@ -19,3 +19,19 @@ cdef int g(int x) nogil:
cdef
int
y
cdef
int
y
y
=
x
+
42
y
=
x
+
42
return
y
return
y
cdef
int
with_gil_func
()
except
0
with
gil
:
raise
Exception
(
"error!"
)
cdef
int
nogil_func
()
nogil
except
0
:
with_gil_func
()
def
test_nogil_exception_propagation
():
"""
>>> test_nogil_exception_propagation()
Traceback (most recent call last):
...
Exception: error!
"""
with
nogil
:
nogil_func
()
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