From cbd7f044d40c3cef33421bab71f3f0081c9e60d5 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 30 Jul 2008 22:38:38 +0200 Subject: [PATCH] fix (or work-around?) for base class vtab type cast problem --- Cython/Compiler/ModuleNode.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 68394529..33c4e9a4 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -836,8 +836,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): #if need_self_cast: # self.generate_self_cast(scope, code) if type.vtabslot_cname: - if base_type: - struct_type_cast = "(struct %s*)" % base_type.vtabstruct_cname + vtab_base_type = type + while vtab_base_type.base_type and vtab_base_type.base_type.vtabstruct_cname: + vtab_base_type = vtab_base_type.base_type + if vtab_base_type is not type: + struct_type_cast = "(struct %s*)" % vtab_base_type.vtabstruct_cname else: struct_type_cast = "" code.putln("p->%s = %s%s;" % ( -- 2.26.2