Skip to content

Commit

Permalink
Clone interners during copy_empty_like.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhartman committed Jul 15, 2024
1 parent ce6a0da commit ba104f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/circuit/src/dag_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,13 +1141,14 @@ def _format(operand):
/// Returns:
/// DAGCircuit: An empty copy of self.
fn copy_empty_like(&self, py: Python) -> PyResult<Self> {
// TODO: clone interners!
let mut target_dag = DAGCircuit::new(py)?;
target_dag.name = self.name.as_ref().map(|n| n.clone_ref(py));
target_dag.global_phase = self.global_phase.clone_ref(py);
target_dag.duration = self.duration.as_ref().map(|d| d.clone_ref(py));
target_dag.unit = self.unit.clone();
target_dag.metadata = self.metadata.as_ref().map(|m| m.clone_ref(py));
target_dag.qargs_cache = self.qargs_cache.clone();
target_dag.cargs_cache = self.cargs_cache.clone();

for bit in self.qubits.bits() {
target_dag.add_qubit_unchecked(py, bit.bind(py))?;
Expand Down

0 comments on commit ba104f7

Please sign in to comment.