From 32f524a30940c7b5271b8a7ca1bf936a73a530ab Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Tue, 12 Feb 2008 19:05:47 -0800 Subject: [PATCH] Temporary python object casts OK for numeric types. --- Cython/Compiler/ExprNodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 824909b9..7892aed8 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -2649,8 +2649,8 @@ class TypecastNode(ExprNode): self.operand.analyse_types(env) to_py = self.type.is_pyobject from_py = self.operand.type.is_pyobject - if from_py and not to_py and self.operand.is_ephemeral(): - error(self.pos, "Casting temporary Python object to non-Python type") + if from_py and not to_py and self.operand.is_ephemeral() and not self.type.is_numeric: + error(self.pos, "Casting temporary Python object to non-numeric non-Python type") if to_py and not from_py: self.result_ctype = py_object_type self.is_temp = 1 -- 2.26.2