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
5bc3a71e
Commit
5bc3a71e
authored
Oct 01, 2010
by
Lisandro Dalcin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
protect PyGILState_Ensure|Release for Python configured without threads
parent
2a8c7772
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+9
-1
No files found.
Cython/Compiler/Nodes.py
View file @
5bc3a71e
...
@@ -1284,7 +1284,9 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -1284,7 +1284,9 @@ class FuncDefNode(StatNode, BlockNode):
acquire_gil
=
self
.
acquire_gil
acquire_gil
=
self
.
acquire_gil
if
acquire_gil
:
if
acquire_gil
:
env
.
use_utility_code
(
force_init_threads_utility_code
)
env
.
use_utility_code
(
force_init_threads_utility_code
)
code
.
putln
(
"#ifdef WITH_THREAD"
)
code
.
putln
(
"PyGILState_STATE _save = PyGILState_Ensure();"
)
code
.
putln
(
"PyGILState_STATE _save = PyGILState_Ensure();"
)
code
.
putln
(
"#endif"
)
# ----- set up refnanny
# ----- set up refnanny
if
not
lenv
.
nogil
:
if
not
lenv
.
nogil
:
code
.
put_setup_refcount_context
(
self
.
entry
.
name
)
code
.
put_setup_refcount_context
(
self
.
entry
.
name
)
...
@@ -1469,7 +1471,9 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -1469,7 +1471,9 @@ class FuncDefNode(StatNode, BlockNode):
code
.
put_finish_refcount_context
()
code
.
put_finish_refcount_context
()
if
acquire_gil
:
if
acquire_gil
:
code
.
putln
(
"#ifdef WITH_THREAD"
)
code
.
putln
(
"PyGILState_Release(_save);"
)
code
.
putln
(
"PyGILState_Release(_save);"
)
code
.
putln
(
"#endif"
)
if
not
self
.
return_type
.
is_void
:
if
not
self
.
return_type
.
is_void
:
code
.
putln
(
"return %s;"
%
Naming
.
retval_cname
)
code
.
putln
(
"return %s;"
%
Naming
.
retval_cname
)
...
@@ -5085,7 +5089,9 @@ class GILStatNode(TryFinallyStatNode):
...
@@ -5085,7 +5089,9 @@ class GILStatNode(TryFinallyStatNode):
def
generate_execution_code
(
self
,
code
):
def
generate_execution_code
(
self
,
code
):
code
.
mark_pos
(
self
.
pos
)
code
.
mark_pos
(
self
.
pos
)
if
self
.
state
==
'gil'
:
if
self
.
state
==
'gil'
:
code
.
putln
(
"#ifdef WITH_THREAD"
)
code
.
putln
(
"{ PyGILState_STATE _save = PyGILState_Ensure();"
)
code
.
putln
(
"{ PyGILState_STATE _save = PyGILState_Ensure();"
)
code
.
putln
(
"#endif"
)
else
:
else
:
code
.
putln
(
"{ PyThreadState *_save;"
)
code
.
putln
(
"{ PyThreadState *_save;"
)
code
.
putln
(
"Py_UNBLOCK_THREADS"
)
code
.
putln
(
"Py_UNBLOCK_THREADS"
)
...
@@ -5105,7 +5111,9 @@ class GILExitNode(StatNode):
...
@@ -5105,7 +5111,9 @@ class GILExitNode(StatNode):
def
generate_execution_code
(
self
,
code
):
def
generate_execution_code
(
self
,
code
):
if
self
.
state
==
'gil'
:
if
self
.
state
==
'gil'
:
code
.
putln
(
"PyGILState_Release();"
)
code
.
putln
(
"#ifdef WITH_THREAD"
)
code
.
putln
(
"PyGILState_Release(_save); }"
)
code
.
putln
(
"#endif"
)
else
:
else
:
code
.
putln
(
"Py_BLOCK_THREADS"
)
code
.
putln
(
"Py_BLOCK_THREADS"
)
...
...
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