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
c951d4e2
Commit
c951d4e2
authored
May 01, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid GIL error for optimised container bool tests that run in plain C
parent
ff9c18d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
tests/run/builtins_truth_test.pyx
tests/run/builtins_truth_test.pyx
+17
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
c951d4e2
...
@@ -6321,7 +6321,7 @@ class CoerceToBooleanNode(CoercionNode):
...
@@ -6321,7 +6321,7 @@ class CoerceToBooleanNode(CoercionNode):
self
.
is_temp
=
1
self
.
is_temp
=
1
def
nogil_check
(
self
,
env
):
def
nogil_check
(
self
,
env
):
if
self
.
arg
.
type
.
is_pyobject
:
if
self
.
arg
.
type
.
is_pyobject
and
self
.
_special_builtins
.
get
(
self
.
arg
.
type
)
is
None
:
self
.
gil_error
()
self
.
gil_error
()
gil_message
=
"Truth-testing Python object"
gil_message
=
"Truth-testing Python object"
...
...
tests/run/builtins_truth_test.pyx
View file @
c951d4e2
...
@@ -24,6 +24,23 @@ def if_list(list obj):
...
@@ -24,6 +24,23 @@ def if_list(list obj):
else
:
else
:
return
False
return
False
def
if_list_nogil
(
list
obj
):
"""
>>> if_list_nogil( [] )
False
>>> if_list_nogil( [1] )
True
>>> if_list_nogil(None)
False
"""
cdef
bint
result
with
nogil
:
if
obj
:
result
=
True
else
:
result
=
False
return
result
def
if_list_literal
(
t
):
def
if_list_literal
(
t
):
"""
"""
>>> if_list_literal(True)
>>> if_list_literal(True)
...
...
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