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
d817949d
Commit
d817949d
authored
Jul 07, 2010
by
Craig Citro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix an error with coercing C ints in boolean context.
parent
dc4c6c5c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+6
-1
tests/run/boolean_context.pyx
tests/run/boolean_context.pyx
+8
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
d817949d
...
...
@@ -6268,7 +6268,12 @@ class CoerceToPyTypeNode(CoercionNode):
return
False
def
coerce_to_boolean
(
self
,
env
):
return
self
.
arg
.
coerce_to_boolean
(
env
).
coerce_to_temp
(
env
)
arg_type
=
self
.
arg
.
type
if
(
arg_type
==
PyrexTypes
.
c_bint_type
or
(
arg_type
.
is_pyobject
and
arg_type
.
name
==
'bool'
)):
return
self
.
arg
.
coerce_to_temp
(
env
)
else
:
return
CoerceToBooleanNode
(
self
,
env
)
def
coerce_to_integer
(
self
,
env
):
# If not already some C integer type, coerce to longint.
...
...
tests/run/boolean_context.pyx
0 → 100644
View file @
d817949d
def
test
():
"""
>>> test()
True
"""
cdef
int
x
=
5
print
bool
(
x
)
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