From: Stefan Behnel Date: Wed, 30 Jul 2008 20:38:38 +0000 (+0200) Subject: fix (or work-around?) for base class vtab type cast problem X-Git-Tag: 0.9.8.1~108^2~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cbd7f044d40c3cef33421bab71f3f0081c9e60d5;p=cython.git fix (or work-around?) for base class vtab type cast problem --- 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;" % (