From: Robert Bradshaw Date: Wed, 13 Feb 2008 03:05:47 +0000 (-0800) Subject: Temporary python object casts OK for numeric types. X-Git-Tag: 0.9.6.14~29^2~35 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=32f524a30940c7b5271b8a7ca1bf936a73a530ab;p=cython.git Temporary python object casts OK for numeric types. --- 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