Handle instructions without label in mpl drawer#4389
Handle instructions without label in mpl drawer#4389mtreinish wants to merge 12 commits intoQiskit:masterfrom
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
getattrand fixing thefallback behavior to one that actually works.
Details and comments