From: Stefan Behnel Date: Mon, 22 Mar 2010 08:19:53 +0000 (+0100) Subject: code cleanup X-Git-Tag: 0.13.beta0~260 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f2b2ac048de71543379cd4418f7efdda28237db9;p=cython.git code cleanup --- diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 134538c7..66be8393 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -967,10 +967,12 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): 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): - return node - if not (node.type.is_int or node.type.is_float): - return node + if isinstance(arg, ExprNodes.SimpleCallNode): + if node.type.is_int or node.type.is_float: + return self._optimise_numeric_cast_call(node, arg) + return node + + def _optimise_numeric_cast_call(self, node, arg): function = arg.function if not isinstance(function, ExprNodes.NameNode) \ or not function.type.is_builtin_type \