Commit 1df92c1f authored by Tom Niget's avatar Tom Niget

Fix error for initless classes

parent 88065e00
......@@ -124,7 +124,8 @@ class ModuleVisitorExt(NodeVisitor):
def visit_ClassDef(self, node: ast.ClassDef) -> Iterable[str]:
yield f"py::class_<PROGRAMNS::{node.name}_s::py_type>(m, \"{node.name}\")"
init = node.type.fields["__init__"].type.resolve().remove_self()
if init := node.type.fields.get("__init__", None):
init = init.type.resolve().remove_self()
init_params = init.parameters
yield ".def(py::init<"
yield from join(", ", map(self.visit, init_params))
......
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