diff --git a/f90wrap/f90wrapgen.py b/f90wrap/f90wrapgen.py index 59b4bde9..89fea11d 100644 --- a/f90wrap/f90wrapgen.py +++ b/f90wrap/f90wrapgen.py @@ -532,6 +532,9 @@ def visit_Procedure(self, node): if hasattr(node, "orig_node") and isinstance(node.orig_node, ft.Function): self.write("%s %s" % (node.orig_node.ret_val.type, node.orig_name)) + if "destructor" in node.attributes and "self" in node.deallocate: + node.attributes.append("skip_call") + self.write() self.write_type_class_lines(node) self.write_arg_decl_lines(node) diff --git a/f90wrap/pywrapgen.py b/f90wrap/pywrapgen.py index 5fd659ff..67d3bc1f 100644 --- a/f90wrap/pywrapgen.py +++ b/f90wrap/pywrapgen.py @@ -626,6 +626,14 @@ def visit_Type(self, node): self.write(format_doc_string(node)) self.generic_visit(node) + if(not "class(%(classname)s)" % {"classname": node.name} in self.types): + self.write_member_variables(node) + + self.write() + self.dedent() + self.write() + + def write_member_variables(self, node): properties = [] for el in node.elements: dims = list(filter(lambda x: x.startswith("dimension"), el.attributes)) @@ -643,9 +651,6 @@ def visit_Type(self, node): self.write( "_dt_array_initialisers = [%s]" % (", ".join(node.dt_array_initialisers)) ) - self.write() - self.dedent() - self.write() def write_scalar_wrappers(self, node, el, properties): dct = dict(