From 324666bce1d456d41eebd22517f44c16cc4d5d7e Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 3 Dec 2008 23:03:51 +0100 Subject: [PATCH] fix crashes on type casts --- Cython/Compiler/ExprNodes.py | 2 +- tests/run/r_typecast.pyx | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/run/r_typecast.pyx diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 38796add..36067a0b 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -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 index 00000000..e7884b65 --- /dev/null +++ b/tests/run/r_typecast.pyx @@ -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 et.c_method() -- 2.26.2