Commit 7a738fd0 authored by Stefan Behnel's avatar Stefan Behnel

drop redundant C->Py->C coercions after optimisations

parent b4c27d34
...@@ -962,6 +962,11 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): ...@@ -962,6 +962,11 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
return arg return arg
else: else:
return arg.coerce_to(node.type, self.env_stack[-1]) return arg.coerce_to(node.type, self.env_stack[-1])
if isinstance(arg, ExprNodes.CoerceToPyTypeNode):
if arg.type is PyrexTypes.py_object_type:
if node.type.assignable_from(arg.arg.type):
# completely redundant C->Py->C coercion
return arg.arg.coerce_to(node.type, self.env_stack[-1])
if not isinstance(arg, ExprNodes.SimpleCallNode): if not isinstance(arg, ExprNodes.SimpleCallNode):
return node return node
if not (node.type.is_int or node.type.is_float): if not (node.type.is_int or node.type.is_float):
......
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