Commit d15bbcd4 authored by Stefan Behnel's avatar Stefan Behnel

fix coercion optimisation

parent ba225656
...@@ -1044,6 +1044,8 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): ...@@ -1044,6 +1044,8 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
""" """
self.visitchildren(node) self.visitchildren(node)
arg = node.arg arg = node.arg
if isinstance(arg, ExprNodes.PyTypeTestNode):
arg = arg.arg
if isinstance(arg, ExprNodes.CoerceToPyTypeNode): if isinstance(arg, ExprNodes.CoerceToPyTypeNode):
if arg.type in (PyrexTypes.py_object_type, Builtin.bool_type): if arg.type in (PyrexTypes.py_object_type, Builtin.bool_type):
return arg.arg.coerce_to_boolean(self.current_env()) return arg.arg.coerce_to_boolean(self.current_env())
......
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