Skip to content

Commit

Permalink
Avoid double finalisation
Browse files Browse the repository at this point in the history
  • Loading branch information
krystophny committed Nov 26, 2024
1 parent 8525530 commit 1d9772e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions f90wrap/f90wrapgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 8 additions & 3 deletions f90wrap/pywrapgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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(
Expand Down

0 comments on commit 1d9772e

Please sign in to comment.