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):
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
......
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