Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple nested custom controlled gates in QPY #10537

Merged
merged 2 commits into from
Aug 7, 2023

Conversation

jakelishman
Copy link
Member

Summary

When a circuit contained multiple custom controlled gates that in turn had custom definitions, the QPY serialisation could fail to write out some of the inner instructions correctly. This led to an invalid QPY file that could not be read back.

Details and comments

Fix #9746.

When a circuit contained multiple custom controlled gates that in turn
had custom definitions, the QPY serialisation could fail to write out
some of the inner instructions correctly.  This led to an invalid QPY
file that could not be read back.
@jakelishman jakelishman added stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: Bugfix Include in the "Fixed" section of the changelog mod: qpy Related to QPY serialization labels Jul 31, 2023
@jakelishman jakelishman added this to the 0.25.1 milestone Jul 31, 2023
@jakelishman jakelishman requested a review from a team as a code owner July 31, 2023 17:26
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core
  • @mtreinish
  • @nkanazawa1989

@coveralls
Copy link

Pull Request Test Coverage Report for Build 5717882763

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 11 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.009%) to 85.901%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 93.76%
qiskit/extensions/unitary.py 1 93.75%
crates/qasm2/src/lex.rs 3 90.63%
crates/qasm2/src/parse.rs 6 97.6%
Totals Coverage Status
Change from base Build 5717545484: -0.009%
Covered Lines: 73069
Relevant Lines: 85062

💛 - Coveralls

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this was clearly a bug and the fix seems straightforward. Thanks for diving into this.

@mtreinish mtreinish added this pull request to the merge queue Aug 7, 2023
Merged via the queue into Qiskit:main with commit 06416d7 Aug 7, 2023
14 checks passed
mergify bot pushed a commit that referenced this pull request Aug 7, 2023
* Fix multiple nested custom controlled gates in QPY

When a circuit contained multiple custom controlled gates that in turn
had custom definitions, the QPY serialisation could fail to write out
some of the inner instructions correctly.  This led to an invalid QPY
file that could not be read back.

* Remove local warning-suppression import

(cherry picked from commit 06416d7)
github-merge-queue bot pushed a commit that referenced this pull request Aug 7, 2023
* Fix multiple nested custom controlled gates in QPY

When a circuit contained multiple custom controlled gates that in turn
had custom definitions, the QPY serialisation could fail to write out
some of the inner instructions correctly.  This led to an invalid QPY
file that could not be read back.

* Remove local warning-suppression import

(cherry picked from commit 06416d7)

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
SamD-1998 pushed a commit to SamD-1998/qiskit-terra that referenced this pull request Sep 7, 2023
* Fix multiple nested custom controlled gates in QPY

When a circuit contained multiple custom controlled gates that in turn
had custom definitions, the QPY serialisation could fail to write out
some of the inner instructions correctly.  This led to an invalid QPY
file that could not be read back.

* Remove local warning-suppression import
@jakelishman jakelishman deleted the qpy/nested-conditional branch February 7, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog mod: qpy Related to QPY serialization stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QPY invalid payload generation via compose() or QuantumCircuit.control()
4 participants