Commit 84b1de27 authored by Stefan Behnel's avatar Stefan Behnel

work around compiler crash on float().conjugate() for a trivial case by optimising it away

parent 56c7afe1
......@@ -1262,6 +1262,9 @@ class EarlyReplaceBuiltinCalls(Visitor.EnvTransform):
return ExprNodes.FloatNode(node.pos, value='0.0')
if len(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
class YieldNodeCollector(Visitor.TreeVisitor):
......
......@@ -44,3 +44,11 @@ def complex_arg(complex c):
(1.0, 2.0)
"""
return (c.real, c.imag)
def complex_conjugate_nonsimple_float():
"""
>>> complex_conjugate_nonsimple_float()
1.0
"""
x = float(1.0).conjugate()
return x
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment