From ccd65093d030a828cd96bc59b6abd29b22e7997d Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 18 Dec 2008 18:04:44 +0100 Subject: [PATCH] avoid recursive coercion in CoerceToPyTypeNode --- Cython/Compiler/ExprNodes.py | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- 2.26.2