From: Stefan Behnel Date: Thu, 18 Dec 2008 17:04:44 +0000 (+0100) Subject: avoid recursive coercion in CoerceToPyTypeNode X-Git-Tag: 0.11-beta~113 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ccd65093d030a828cd96bc59b6abd29b22e7997d;p=cython.git avoid recursive coercion in CoerceToPyTypeNode --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 8e14914d..c4bcd674 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -4932,6 +4932,13 @@ class CoerceToPyTypeNode(CoercionNode): def coerce_to_boolean(self, env): return self.arg.coerce_to_boolean(env).coerce_to_temp(env) + + def coerce_to_integer(self, env): + # If not already some C integer type, coerce to longint. + if self.arg.type.is_int: + return self.arg + else: + return self.arg.coerce_to(PyrexTypes.c_long_type, env) def analyse_types(self, env): # The arg is always already analysed