Skip to content

Commit

Permalink
Use relative import when importing self module
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel committed Jan 20, 2025
1 parent 10bc76e commit cb83562
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion f90wrap/pywrapgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,11 @@ def visit_Type(self, node):
if node.parent.mod_name != node.mod_name:
cls_parent = "%s.%s" % (node.parent.mod_name, cls_parent)
if self.make_package:
self.imports.add((self.py_mod_name, node.parent.mod_name))
if self.relative:
py_mod_name = '.'
else:
py_mod_name = self.py_mod_name
self.imports.add((py_mod_name, node.parent.mod_name))
self.write(
'@f90wrap.runtime.register_class("%s.%s")' % (self.py_mod_name, cls_name)
)
Expand Down

0 comments on commit cb83562

Please sign in to comment.