fix crashes on type casts
authorStefan Behnel <scoder@users.berlios.de>
Wed, 3 Dec 2008 22:03:51 +0000 (23:03 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 3 Dec 2008 22:03:51 +0000 (23:03 +0100)
Cython/Compiler/ExprNodes.py
tests/run/r_typecast.pyx [new file with mode: 0644]

index 38796add27576bde0113a1198a6a164b5e83a1ec..36067a0b1e51e001113c1bcdff64a047888e3275 100644 (file)
@@ -3585,7 +3585,7 @@ def unop_node(pos, operator, operand):
         operand = operand)
 
 
-class TypecastNode(ExprNode):
+class TypecastNode(NewTempExprNode):
     #  C type cast
     #
     #  operand      ExprNode
diff --git a/tests/run/r_typecast.pyx b/tests/run/r_typecast.pyx
new file mode 100644 (file)
index 0000000..e7884b6
--- /dev/null
@@ -0,0 +1,14 @@
+u"""
+>>> call_method( ExtType() ).method()
+1
+"""
+
+cdef class ExtType:
+    cdef c_method(self):
+        return self
+
+    def method(self):
+        return 1
+
+def call_method(ExtType et):
+    return <ExtType>et.c_method()