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
Kirill Smelkov
cython
Commits
59820426
Commit
59820426
authored
Jan 14, 2012
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CondExprNode: fix casting in assignment
parent
efbac550
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
tests/run/if_else_expr.pyx
tests/run/if_else_expr.pyx
+16
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
59820426
...
...
@@ -8003,7 +8003,7 @@ class CondExprNode(ExprNode):
def
eval_and_get
(
self
,
code
,
expr
):
expr
.
generate_evaluation_code
(
code
)
expr
.
make_owned_reference
(
code
)
code
.
putln
(
"%s = %s;"
%
(
self
.
result
(),
expr
.
result
(
)))
code
.
putln
(
'%s = %s;'
%
(
self
.
result
(),
expr
.
result_as
(
self
.
ctype
()
)))
expr
.
generate_post_assignment_code
(
code
)
expr
.
free_temps
(
code
)
...
...
tests/run/if_else_expr.pyx
0 → 100644
View file @
59820426
# mode: run
# tag: if_else_expr
cdef
class
Foo
:
def
__repr__
(
self
):
return
'<Foo>'
cpdef
test_type_cast
(
Foo
obj
,
cond
):
"""
# Regression test: obj must be cast to (PyObject *) here
>>> test_type_cast(Foo(), True)
[<Foo>]
>>> test_type_cast(Foo(), False)
<Foo>
"""
return
[
obj
]
if
cond
else
obj
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