-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Handle instructions without label in mpl drawer #4389
Conversation
Currently the mpl drawer is unconditionally accessing a label attribute for several classes of instructions. However, it is not guaranteed that a label is set for these instructions. This can cause a failure when going to draw a circuit with these instructions if the label doesn't exist. This commit fixes the issue by using a getattr and fixing the fallback behavior to one that actually works.
MPL circuit drawer issues are piling up, since we dont have a good way to track changes on it. I'm putting this PR |
#4544 is merged... Let's add a test with the new method! I will try helping, but fill free to do it yourself and ask me if any question. |
Sorry for the delay, this should be ready to review now |
this seems already done via #4616 |
Yeah, the bug that this was fixing is indeed closed by #4616. I'm not able to reproduce hard failures. It looks like it introduced other issues with the drawer, like the circuit names are being unconditionally treated as latex strings now which is different from expectations and causes weird formatting for some library elements. But we can open separate issues and fix those in a followup |
Summary
Currently the mpl drawer is unconditionally accessing a label attribute
for several classes of instructions. However, it is not guaranteed that
a label is set for these instructions. This can cause a failure when
going to draw a circuit with these instructions if the label doesn't
exist. This commit fixes the issue by using a
getattr
and fixing thefallback behavior to one that actually works.
Details and comments