Commit f1f699a7 authored by gsamain's avatar gsamain

Fix cypclass attr not initialized to NULL (breaks refcount)

parent f8381cb0
...@@ -920,6 +920,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -920,6 +920,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
constructor = None constructor = None
destructor = None destructor = None
for attr in scope.var_entries: for attr in scope.var_entries:
cname = attr.cname
if attr.type.is_cfunction and attr.type.is_static_method: if attr.type.is_cfunction and attr.type.is_static_method:
code.put("static ") code.put("static ")
elif attr.name == "<init>": elif attr.name == "<init>":
...@@ -930,7 +931,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -930,7 +931,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
elif attr.type.is_cfunction: elif attr.type.is_cfunction:
code.put("virtual ") code.put("virtual ")
has_virtual_methods = True has_virtual_methods = True
code.putln("%s;" % attr.type.declaration_code(attr.cname)) elif attr.type.is_cyp_class:
cname = "%s = NULL" % cname
code.putln("%s;" % attr.type.declaration_code(cname))
is_implementing = 'init_module' in code.globalstate.parts is_implementing = 'init_module' in code.globalstate.parts
def generate_cpp_constructor_code(arg_decls, arg_names, is_implementing, py_attrs, constructor): def generate_cpp_constructor_code(arg_decls, arg_names, is_implementing, py_attrs, constructor):
......
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