Skip to content

Fix display of Box End after transpile in text drawer (backport #14278) #14324

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

Closed
wants to merge 2 commits into from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented May 8, 2025

Summary

Fix #14271

Details and comments

This fixes a problem when the text drawer incorrectly displayed the End of a Box after a transpile.

qc = QuantumCircuit(4)
with qc.box():
    qc.cx(0,1)
    qc.cx(0,3)

qc_ = transpile(qc, initial_layout=[2,3,1,0])

print(qc_.draw(idle_wires=True))

Now produces

         ┌───────      ┌───┐ ───────┐
q_3 -> 0 ┤        ─────┤ X ├        ├─
         │             └─┬─┘        │
q_2 -> 1 ┤        ───────┼──        ├─
         │ Box-0         │    End-0 │
q_0 -> 2 ┤        ──■────■──        ├─
         │        ┌─┴─┐             │
q_1 -> 3 ┤        ┤ X ├─────        ├─
         └─────── └───┘      ───────┘
```<hr>This is an automatic backport of pull request #14278 done by [Mergify](https://mergify.com).

* Fix typing-extensions

* Fix text drawer flow end display

* Lint

* Add reno

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
(cherry picked from commit 3e96ade)

# Conflicts:
#	test/python/visualization/test_circuit_text_drawer.py
@mergify mergify bot added the conflicts used by mergify when there are conflicts in a port label May 8, 2025
@mergify mergify bot requested review from nonhermitian and a team as code owners May 8, 2025 11:43
@mergify mergify bot added the conflicts used by mergify when there are conflicts in a port label May 8, 2025
Copy link
Contributor Author

mergify bot commented May 8, 2025

Cherry-pick of 3e96ade has failed:

On branch mergify/bp/stable/1.4/pr-14278
Your branch is up to date with 'origin/stable/1.4'.

You are currently cherry-picking commit 3e96ade54.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   qiskit/visualization/circuit/text.py
	new file:   releasenotes/notes/draw-control-flow-end-ceb58ed2c46ff758.yaml

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   test/python/visualization/test_circuit_text_drawer.py

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the following people are relevant to this code:

@github-actions github-actions bot added this to the 2.0.1 milestone May 8, 2025
@github-actions github-actions bot added Changelog: Bugfix Include in the "Fixed" section of the changelog mod: visualization qiskit.visualization labels May 8, 2025
@ElePT ElePT modified the milestones: 2.0.1, 1.4.3 May 8, 2025
@ElePT ElePT removed the conflicts used by mergify when there are conflicts in a port label May 8, 2025
@ElePT ElePT enabled auto-merge May 8, 2025 11:54
@ElePT ElePT disabled auto-merge May 8, 2025 12:34
@ElePT ElePT closed this May 8, 2025
@jakelishman jakelishman deleted the mergify/bp/stable/1.4/pr-14278 branch June 9, 2025 15:41
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: visualization qiskit.visualization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants