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
84b1de27
Commit
84b1de27
authored
Nov 29, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work around compiler crash on float().conjugate() for a trivial case by optimising it away
parent
56c7afe1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+3
-0
tests/run/builtincomplex.pyx
tests/run/builtincomplex.pyx
+8
-0
No files found.
Cython/Compiler/Optimize.py
View file @
84b1de27
...
@@ -1262,6 +1262,9 @@ class EarlyReplaceBuiltinCalls(Visitor.EnvTransform):
...
@@ -1262,6 +1262,9 @@ class EarlyReplaceBuiltinCalls(Visitor.EnvTransform):
return
ExprNodes
.
FloatNode
(
node
.
pos
,
value
=
'0.0'
)
return
ExprNodes
.
FloatNode
(
node
.
pos
,
value
=
'0.0'
)
if
len
(
pos_args
)
>
1
:
if
len
(
pos_args
)
>
1
:
self
.
_error_wrong_arg_count
(
'float'
,
node
,
pos_args
,
1
)
self
.
_error_wrong_arg_count
(
'float'
,
node
,
pos_args
,
1
)
arg_type
=
getattr
(
pos_args
[
0
],
'type'
,
None
)
if
arg_type
in
(
PyrexTypes
.
c_double_type
,
Builtin
.
float_type
):
return
pos_args
[
0
]
return
node
return
node
class
YieldNodeCollector
(
Visitor
.
TreeVisitor
):
class
YieldNodeCollector
(
Visitor
.
TreeVisitor
):
...
...
tests/run/builtincomplex.pyx
View file @
84b1de27
...
@@ -44,3 +44,11 @@ def complex_arg(complex c):
...
@@ -44,3 +44,11 @@ def complex_arg(complex c):
(1.0, 2.0)
(1.0, 2.0)
"""
"""
return
(
c
.
real
,
c
.
imag
)
return
(
c
.
real
,
c
.
imag
)
def
complex_conjugate_nonsimple_float
():
"""
>>> complex_conjugate_nonsimple_float()
1.0
"""
x
=
float
(
1.0
).
conjugate
()
return
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