-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 pickling of conditioned custom gates from OpenQASM 2 import #11175
Fix pickling of conditioned custom gates from OpenQASM 2 import #11175
Conversation
The condition of a gate defined by a `gate` statement in an OpenQASM 2 program was not previously exported as part of its state during pickling, causing pickle roundtrips or deepcopies to lose the condition on the new copy.
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 6733858362
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not an expert on OpenQASM but the fix looks reasonably simple and the test covers all the potential pain points described in #11174 (deep-copying and pickling), so LGTM. Out of curiosity, are there ways to define conditional custom gates without a gate
statement? asking because of the way the reno is phrased.
No, the OQ2 language doesn't support that - the phrasing in the release note is supposed to imply
and not
I can change it if you prefer to be clearer. |
I think that is ok, it's probably clear to the target audience of the reno and I was just lacking background knowledge. |
The condition of a gate defined by a `gate` statement in an OpenQASM 2 program was not previously exported as part of its state during pickling, causing pickle roundtrips or deepcopies to lose the condition on the new copy. (cherry picked from commit 196221f)
…) (#11258) The condition of a gate defined by a `gate` statement in an OpenQASM 2 program was not previously exported as part of its state during pickling, causing pickle roundtrips or deepcopies to lose the condition on the new copy. (cherry picked from commit 196221f) Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
Summary
The condition of a gate defined by a
gate
statement in an OpenQASM 2 program was not previously exported as part of its state during pickling, causing pickle roundtrips or deepcopies to lose the condition on the new copy.Details and comments
Fix #11174.