From f2b2ac048de71543379cd4418f7efdda28237db9 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Mon, 22 Mar 2010 09:19:53 +0100 Subject: [PATCH] code cleanup --- Cython/Compiler/Optimize.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 \ -- 2.26.2