Skip to content

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jul 29, 2021

This is an automatic backport of pull request #6775 done by Mergify.


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.io/

* Handle single bit conditions in QPY

In #6018 initial support for adding classical conditions on a single bit
instead of a register was added. However this wasn't accounted for in
qpy because it didn't exist when qpy was first written. This commit adds
support to qpy without a file format change so it can be backported and
used with already released versions of qpy without needing a new format
version. This is accomplished by exploiting the strict register naming
in qiskit. A register can't have a name outside of regex
"[a-z][a-zA-Z0-9_]*" which we leverage in the case of single clbit
conditions the "register" name in the output QPY data is set to
str(clbit_index) which isn't a valid name. Then on the loading side we
check for a valid name, if it's outside the allowed regex we treat the
condition as a single bit and the name is a str(index). The tradeoff here
is that for a QPY file generated with 0.18.1 (assuming this is backported
and included in 0.18.1) this qpy file can not be loaded with qiskit
0.18.0. But this is fine as we only guarantee compatibility in one
direction (loading qpy files generated with older with qiskit with a
newer version of qiskit).

Fixes partially #6475

* Add release note

* Prefix bit index with null character

This commit modifies the special string we use in the register name
field to be prefixed with a null character. This leaves open using the
string for other special cases and also returning a sane error if an
invalid QPY file was generated by something besides Qiskit.

* Update qiskit/circuit/qpy_serialization.py

Co-authored-by: Jake Lishman <jake@binhbar.com>

* Add note to release note about feature not being supported

* Add backwards compat test case too

Co-authored-by: Jake Lishman <jake@binhbar.com>
Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit afb0c47)
@mergify mergify bot requested a review from a team as a code owner July 29, 2021 20:24
@jakelishman jakelishman added automerge Changelog: Bugfix Include in the "Fixed" section of the changelog labels Jul 29, 2021
@mergify mergify bot merged commit 5eaa34d into stable/0.18 Jul 29, 2021
@mergify mergify bot deleted the mergify/bp/stable/0.18/pr-6775 branch July 29, 2021 22:30
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants