From: Stefan Behnel Date: Mon, 2 Mar 2009 14:18:02 +0000 (+0100) Subject: prevent generating empty code section during vtable setup X-Git-Tag: 0.11.rc~12^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a30385807d0b51bfa91efbaa493f1a138d6f98dc;p=cython.git prevent generating empty code section during vtable setup --- diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 9127535e..02da5202 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -1971,23 +1971,24 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): c_method_entries = [ entry for entry in type.scope.cfunc_entries if entry.func_cname ] - code.putln('#if PY_MAJOR_VERSION >= 3') - for meth_entry in c_method_entries: - cast = meth_entry.type.signature_cast_string() - code.putln( - "%s.%s = %s%s;" % ( - type.vtable_cname, - meth_entry.cname, - cast, - meth_entry.func_cname)) - code.putln('#else') - for meth_entry in c_method_entries: - code.putln( - "*(void(**)(void))&%s.%s = (void(*)(void))%s;" % ( - type.vtable_cname, - meth_entry.cname, - meth_entry.func_cname)) - code.putln('#endif') + if c_method_entries: + code.putln('#if PY_MAJOR_VERSION >= 3') + for meth_entry in c_method_entries: + cast = meth_entry.type.signature_cast_string() + code.putln( + "%s.%s = %s%s;" % ( + type.vtable_cname, + meth_entry.cname, + cast, + meth_entry.func_cname)) + code.putln('#else') + for meth_entry in c_method_entries: + code.putln( + "*(void(**)(void))&%s.%s = (void(*)(void))%s;" % ( + type.vtable_cname, + meth_entry.cname, + meth_entry.func_cname)) + code.putln('#endif') def generate_typeptr_assignment_code(self, entry, code): # Generate code to initialise the typeptr of an extension