qiskit/releasenotes/notes/0.17/pm_cb_remove_5522-30358587a...

34 lines
948 B
YAML

---
upgrade:
- |
The previously deprecated kwarg ``callback`` on the constructor for the
:class:`~qiskit.transpiler.PassManager` class has been removed. This
kwarg has been deprecated since the 0.13.0 release (April, 9th 2020).
Instead you can pass the ``callback`` kwarg to the
:meth:`qiskit.transpiler.PassManager.run` method directly. For example,
if you were using::
from qiskit.circuit.random import random_circuit
from qiskit.transpiler import PassManager
qc = random_circuit(2, 2)
def callback(**kwargs)
print(kwargs['pass_'])
pm = PassManager(callback=callback)
pm.run(qc)
this can be replaced with::
from qiskit.circuit.random import random_circuit
from qiskit.transpiler import PassManager
qc = random_circuit(2, 2)
def callback(**kwargs)
print(kwargs['pass_'])
pm = PassManager()
pm.run(qc, callback=callback)