Skip to content
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

Logical error in transpiler.py #9885

Closed
wshanks opened this issue Mar 30, 2023 · 0 comments · Fixed by #9886
Closed

Logical error in transpiler.py #9885

wshanks opened this issue Mar 30, 2023 · 0 comments · Fixed by #9886
Labels
bug Something isn't working

Comments

@wshanks
Copy link
Contributor

wshanks commented Mar 30, 2023

Environment

  • Qiskit Terra version: 7ae670a
  • Python version: n/a
  • Operating system: n/a

What is happening?

While debugging other issues with the coupling_map, I noticed a puzzling section in the code:

https://github.com/Qiskit/qiskit-terra/blob/1282a04d528dd56d8e401dccc388a32178e9c6cc/qiskit/compiler/transpiler.py#L358-L361

At this point, coupling_map is either a CouplingMap, a list of lists of integers, or None and unique_transpile_args is a list of dicts with these keys:

https://github.com/Qiskit/qiskit-terra/blob/1282a04d528dd56d8e401dccc388a32178e9c6cc/qiskit/compiler/transpiler.py#L757-L763

So I don't see how this condition could ever be true.

How can we reproduce the issue?

Here is some code that can raise an exception because of the problem with the code:

from qiskit import QuantumCircuit, transpile

qc = QuantumCircuit(1)

transpile([qc] * 2, coupling_map=[None, None])

What should happen?

No error for the above code.

Any suggestions?

I think code needs to check if "coupling_map" is in the shared dict, pull the coupling maps out of the unique dicts if not.

@wshanks wshanks added the bug Something isn't working label Mar 30, 2023
wshanks added a commit to wshanks/qiskit-terra that referenced this issue Mar 30, 2023
mtreinish pushed a commit that referenced this issue Apr 4, 2023
* Fixed handling of a list of coupling_maps passed to transpile()

Closes #9885

* Update qiskit/compiler/transpiler.py

* Add test

* Release note

* Fix test
giacomoRanieri pushed a commit to giacomoRanieri/qiskit-terra that referenced this issue Apr 16, 2023
…it#9886)

* Fixed handling of a list of coupling_maps passed to transpile()

Closes Qiskit#9885

* Update qiskit/compiler/transpiler.py

* Add test

* Release note

* Fix test
king-p3nguin pushed a commit to king-p3nguin/qiskit-terra that referenced this issue May 22, 2023
…it#9886)

* Fixed handling of a list of coupling_maps passed to transpile()

Closes Qiskit#9885

* Update qiskit/compiler/transpiler.py

* Add test

* Release note

* Fix test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant