Actual conversion on <type> casts with one side Python
authorRobert Bradshaw <robertwb@math.washington.edu>
Sat, 2 Feb 2008 09:07:03 +0000 (01:07 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sat, 2 Feb 2008 09:07:03 +0000 (01:07 -0800)
Cython/Compiler/ExprNodes.py

index 6f6f6d993ef563ed417f0454c63a8a78e01eb861..7c548864a1f0069346ca5ffd30bca539b2d8a923 100644 (file)
@@ -2608,6 +2608,11 @@ class TypecastNode(ExprNode):
         if to_py and not from_py:
             self.result_ctype = py_object_type
             self.is_temp = 1
+            if self.operand.type.to_py_function:
+                self.operand = self.operand.coerce_to_pyobject(env)
+        elif from_py and not to_py:
+            if self.type.from_py_function:
+                self.operand = self.operand.coerce_to(self.type, env)
     
     def check_const(self):
         self.operand.check_const()