diff --git a/qiskit/transpiler/passes/synthesis/high_level_synthesis.py b/qiskit/transpiler/passes/synthesis/high_level_synthesis.py index 87d953e27f8..d7b5b0d535b 100644 --- a/qiskit/transpiler/passes/synthesis/high_level_synthesis.py +++ b/qiskit/transpiler/passes/synthesis/high_level_synthesis.py @@ -382,7 +382,7 @@ def _run( # If the synthesis changed the operation (i.e. it is not None), store the result. if synthesized is not None: - synthesized_nodes[node] = (synthesized, synthesized_context) + synthesized_nodes[node._node_id] = (synthesized, synthesized_context) # If the synthesis did not change anything, just update the qubit tracker. elif not processed: @@ -407,8 +407,9 @@ def _run( outer_to_local = context.to_local_mapping() for node in dag.topological_op_nodes(): - if node in synthesized_nodes: - op, op_context = synthesized_nodes[node] + + if op_tuple := synthesized_nodes.get(node._node_id, None): + op, op_context = op_tuple if isinstance(op, Operation): out.apply_operation_back(op, node.qargs, node.cargs)