Fix QuantumCircuit.compose for front=True and individual qargs#15872
Fix QuantumCircuit.compose for front=True and individual qargs#15872jakelishman merged 1 commit intoQiskit:mainfrom
QuantumCircuit.compose for front=True and individual qargs#15872Conversation
|
One or more of the following people are relevant to this code:
|
jakelishman
left a comment
There was a problem hiding this comment.
Ohh yeah, now you do it and I look at it a second time it's quite clearly a mistake - no need to remap the instructions that are just getting put back where they belong.
It might be nice to have a bugfix release note for this, since the bug did make it into a (pre)release version of Qiskit.
In your PR commit, if you edit it so it says "Fix #15834" instead of just "#15834", the automatic closing should take effect.
qiskit/circuit/quantumcircuit.py
Outdated
| if append_existing: | ||
| dest._current_scope().extend( | ||
| append_existing, qubits=mapped_qubits, clbits=mapped_clbits | ||
| append_existing, |
There was a problem hiding this comment.
If you delete the trailing comma on this line, the Python code formatter (black) should then squash it all back onto one line.
(I can't do it easily by GitHub suggestion because of a limitation in their feature.)
f0018ad to
d54911a
Compare
QuantumCircuit.compose for front=True and individual qargs
(cherry picked from commit 62f74c7)
When compose() is called with both front=True and a qubits mapping, the original instructions were incorrectly re-appended with the incoming circuit's qubit remap table, causing the error when the circuits had different widths. The fix removes the spurious qubits/clbits arguments from that append, and adds a regression test.
Fix #15834