Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of ControlledGates in QPY (#8055)
* Fix handling of ControlledGates in QPY This commit fixes the handling of ControlledGates in QPY. Previously the extra parameters needed to reconstruct a custom controlled gate were not encoded into the QPY payload. Fixing this required a version bump to the QPY format to modify the payload for a custom instruction entry. Once we added to the format the extra data required for a controlled gate, the number of control qubits, the control state, and the base gate object, the deserializer has enough information to recreate the custom ControlledGate objects. However, fixing this exposed another bug with standard library multicontrolled gates where they often didn't contain sufficient data in the payload to reconstruct either. Fixes #7999 * Fix test failure caused by missing condition This commit fixes the qpy test failure. This was caused by the omission of the classical condition on a controlled gate when reconstructing the circuit in deserialization. Fixing this oversight fixes the test failures. * Add QPY version 5 payload format description * Add release note * Expand test coverage * Only check controlled gate type key on version 5 or newer * Fix mcu1 deserialization * Add copy to avoid mutating list while iterating over it * Fix compat test minimum version This commit fixes the failing compat test which was incorrectly trying to test ControlledGates with 0.20.2 generation. We should only run the controlled gate tests starting with 0.21.0. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information