qiskit/releasenotes/notes/2.0/control-flow-op-nodes-ceece...

12 lines
471 B
YAML

---
upgrade_circuits:
- |
:meth:`.DAGCircuit.control_flow_op_nodes` now always returns a list, even if empty. Previously,
it returned ``None`` if empty, and never returned the empty list, which required special handling.
If you need to explicitly test for emptiness in both Qiskit 1.x and 2.x, you can do::
control_flow_nodes = dag.control_flow_op_nodes()
if not control_flow_nodes:
# There are no control-flow nodes.
pass