Skip to content

Fix typo in no clbit case qpy generation - #27

Merged
Jim Garrison (garrison) merged 1 commit into
Qiskit:mainfrom
mtreinish:fix-type-17
Sep 18, 2026
Merged

Jim Garrison (garrison) merged 1 commit into
Qiskit:mainfrom
mtreinish:fix-type-17

Conversation

@mtreinish

Copy link
Copy Markdown
Member

In #17 the logic check was done backwards. Specifically the condition was an empty vec should be used if there are no clbits, but the if condition was incorrectly using vec![] if there were clbits. This commit fixes the oversight and corrects the logic so it is only populating the classical registers field in the QPY if there are any clbits (not if there are not any clbits).

In Qiskit#17 the logic check was done backwards. Specifically the condition
was an empty vec should be used if there are no clbits, but the if
condition was incorrectly using vec![] if there were clbits. This commit
fixes the oversight and corrects the logic so it is only populating
the classical registers field in the QPY if there are any clbits (not if
there are not any clbits).
@mtreinish

Copy link
Copy Markdown
Member Author

I need to write a test suite for the qpy generation to avoid bugs like this in the future. It was supposed to be short lived until Qiskit/qiskit#15977, but that is taking a bit longer than I originally had hoped so we should have this better tested. The best way to test this will be through Python

@garrison
Jim Garrison (garrison) added this pull request to the merge queue Sep 18, 2026
Merged via the queue into Qiskit:main with commit 46a1065 Sep 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants