-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Labels
bugSomething isn't workingSomething isn't workingmod: circuitRelated to the core of the `QuantumCircuit` class or the circuit libraryRelated to the core of the `QuantumCircuit` class or the circuit library
Milestone
Description
Environment
- Qiskit version: 1.3.2, 1.4.1, main
- Python version: 3.12.9
- Operating system: macOS 15.3.1
What is happening?
DAGCircuit.find_bit
does not work if a dag is deepcopied since 1.3.0
How can we reproduce the issue?
from copy import deepcopy
from qiskit import QuantumCircuit, __version__
from qiskit.converters import circuit_to_dag
print(__version__)
qc = QuantumCircuit(3)
dag = circuit_to_dag(qc)
print(dag.find_bit(dag.qubits[0]).index)
dag2 = deepcopy(dag)
print(dag2.find_bit(dag2.qubits[0]).index)
qiskit 1.2.4
1.2.4
0
0
qiskit 1.3.2
1.3.2
0
Traceback (most recent call last):
File "/Users/ima/tasks/5_2025/scripts/2025/terra/dag.py", line 11, in <module>
print(dag2.find_bit(dag2.qubits[0]).index)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
qiskit.dagcircuit.exceptions.DAGCircuitError: "Could not locate provided bit: Qubit(QuantumRegister(3, 'q'), 0). Has it been added to the DAGCircuit?"
qiskit 1.4.1
1.4.1
0
Traceback (most recent call last):
File "/Users/ima/tasks/5_2025/scripts/2025/terra/dag.py", line 11, in <module>
print(dag2.find_bit(dag2.qubits[0]).index)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
qiskit.dagcircuit.exceptions.DAGCircuitError: "Could not locate provided bit: Qubit(QuantumRegister(3, 'q'), 0). Has it been added to the DAGCircuit?"
main
2.0.0.dev0+2fe67f0
0
Traceback (most recent call last):
File "/Users/ima/tasks/5_2025/scripts/2025/terra/dag.py", line 11, in <module>
print(dag2.find_bit(dag2.qubits[0]).index)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
qiskit.dagcircuit.exceptions.DAGCircuitError: 'Could not locate provided bit: <Qubit register=(3, "q"), index=0>. Has it been added to the DAGCircuit?'
What should happen?
No error as 1.2.4
Any suggestions?
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingmod: circuitRelated to the core of the `QuantumCircuit` class or the circuit libraryRelated to the core of the `QuantumCircuit` class or the circuit library