From 4ef4ba83cdc6aebbc15a509ed669b60782caf886 Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Thu, 14 May 2009 17:34:02 +0200 Subject: [PATCH] If we were using git I could more easily erase my embarrasing commit history... --- Cython/Compiler/ExprNodes.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 55b7ef85..fc608b1d 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -3938,10 +3938,8 @@ class TypecastNode(NewTempExprNode): elif from_py and not to_py: if self.type.from_py_function: self.operand = self.operand.coerce_to(self.type, env) - elif self.type.is_ptr: - base_type = self.type.base_type - if not base_type.is_void and not base_type.is_struct: - error(self.pos, "Python objects can only be cast to void*") + elif self.type.is_ptr and not (self.type.base_type.is_void or self.type.base_type.is_struct): + error(self.pos, "Python objects can only be cast to void*") else: warning(self.pos, "No conversion from %s to %s, python object pointer used." % (self.type, self.operand.type)) elif from_py and to_py: -- 2.26.2