Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Fix typing in DAGCircuit.apply_operation_back (#721)
Browse files Browse the repository at this point in the history
It is not valid typing (per the documentation) to pass `None` to
`DAGCircuit.apply_operation_back` in either the `qargs` or `cargs`
field, though this has been silently accepted previously to support
mistaken code in the Terra schedulers, which this repository has
inherited.
  • Loading branch information
jakelishman authored Aug 31, 2023
1 parent 90d1bef commit 2b3eb71
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@ def _apply_scheduled_op(
block_idx: int,
t_start: int,
oper: Instruction,
qubits: Union[Qubit, List[Qubit]],
clbits: Optional[Union[Clbit, List[Clbit]]] = None,
qubits: Union[Qubit, Iterable[Qubit]],
clbits: Union[Clbit, Iterable[Clbit]] = (),
) -> DAGNode:
"""Add new operation to DAG with scheduled information.
Expand All @@ -589,9 +589,7 @@ def _apply_scheduled_op(
if isinstance(clbits, Clbit):
clbits = [clbits]

new_node = self._block_dag.apply_operation_back(
oper, qargs=qubits, cargs=clbits
)
new_node = self._block_dag.apply_operation_back(oper, qubits, clbits)
self.property_set["node_start_time"][new_node] = (block_idx, t_start)
return new_node

Expand Down

0 comments on commit 2b3eb71

Please sign in to comment.