Commit a3038580 authored by Stefan Behnel's avatar Stefan Behnel

prevent generating empty code section during vtable setup

parent ad40010c
...@@ -1971,23 +1971,24 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1971,23 +1971,24 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
c_method_entries = [ c_method_entries = [
entry for entry in type.scope.cfunc_entries entry for entry in type.scope.cfunc_entries
if entry.func_cname ] if entry.func_cname ]
code.putln('#if PY_MAJOR_VERSION >= 3') if c_method_entries:
for meth_entry in c_method_entries: code.putln('#if PY_MAJOR_VERSION >= 3')
cast = meth_entry.type.signature_cast_string() for meth_entry in c_method_entries:
code.putln( cast = meth_entry.type.signature_cast_string()
"%s.%s = %s%s;" % ( code.putln(
type.vtable_cname, "%s.%s = %s%s;" % (
meth_entry.cname, type.vtable_cname,
cast, meth_entry.cname,
meth_entry.func_cname)) cast,
code.putln('#else') meth_entry.func_cname))
for meth_entry in c_method_entries: code.putln('#else')
code.putln( for meth_entry in c_method_entries:
"*(void(**)(void))&%s.%s = (void(*)(void))%s;" % ( code.putln(
type.vtable_cname, "*(void(**)(void))&%s.%s = (void(*)(void))%s;" % (
meth_entry.cname, type.vtable_cname,
meth_entry.func_cname)) meth_entry.cname,
code.putln('#endif') meth_entry.func_cname))
code.putln('#endif')
def generate_typeptr_assignment_code(self, entry, code): def generate_typeptr_assignment_code(self, entry, code):
# Generate code to initialise the typeptr of an extension # Generate code to initialise the typeptr of an extension
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment