Skip to content

Commit 6a0e270

Browse files
authored
fix: Fixed export of Call and LoadConst nodes in hugr-py. (#2429)
`Call` and `LoadConst` nodes have static inputs which were erroneously exported in `hugr-py`. The function to be called and the constant to be loaded are arguments to the operations in `hugr-model`, so the static input isn't needed. Before this fix, this caused import errors when the same function would be called twice.
1 parent ec207e7 commit 6a0e270

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

hugr-py/src/hugr/model/export.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ def export_node(
204204
error = f"Call node {node} is not connected to a function."
205205
raise ValueError(error)
206206

207+
# We ignore the static input edge since the function is passed
208+
# as an argument instead.
209+
assert len(inputs) == len(input_types) + 1
210+
inputs = inputs[0 : len(inputs) - 1]
211+
207212
func = model.Apply(func_name, func_args)
208213

209214
return model.Node(
@@ -295,7 +300,7 @@ def export_node(
295300
model.Apply("core.load_const", [type, value])
296301
),
297302
signature=signature,
298-
inputs=inputs,
303+
inputs=[],
299304
outputs=outputs,
300305
meta=meta,
301306
)

0 commit comments

Comments
 (0)