Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This commit fixes an issue with the Barrier class's broadcast_arguments() method. Previously the Barrier class was overriding broadcast_arguments(), however this custom implementation resulted in an identical output to the Instruction's implementation (its parent class) but stripped out all the error checking to determine if the arguments aligned with the size of the instruction. This could result in creating a corrupt circuit that had a mismatch between the barrier width and the number of qargs. For example: ``` circuit = QuantumCircuit(1) circuit.append(Barrier(42), [0]) ``` would not error despite trying to add a 42 qubit barrier on qubit 0. This would result in weird errors such as invalid qpy generation that are confusing to debug. This commit fixes this by deleting the broadcast_arguments() implementation for Barrier so it will just depend on the inherited implementation from Instruction which will return an identical result but check the instruction is valid. (cherry picked from commit 5df2439) Co-authored-by: Matthew Treinish <[email protected]>
- Loading branch information