diff --git a/qiskit/transpiler/passes/synthesis/unitary_synthesis.py b/qiskit/transpiler/passes/synthesis/unitary_synthesis.py index 898998d08c63..48bd0b0f8b38 100644 --- a/qiskit/transpiler/passes/synthesis/unitary_synthesis.py +++ b/qiskit/transpiler/passes/synthesis/unitary_synthesis.py @@ -660,7 +660,10 @@ def is_controlled(gate): if props is None: basis_2q_fidelity = 1.0 else: - basis_2q_fidelity = 1 - getattr(props, "error", 0.0) + error = getattr(props, "error", 0.0) + if error is None: + error = 0.0 + basis_2q_fidelity = 1 - error if approximation_degree is not None: basis_2q_fidelity *= approximation_degree decomposer = TwoQubitBasisDecomposer( @@ -682,7 +685,10 @@ def is_controlled(gate): if props is None: basis_2q_fidelity[strength] = 1.0 else: - basis_2q_fidelity[strength] = 1 - getattr(props, "error", 0.0) + error = getattr(props, "error", 0.0) + if error is None: + error = 0.0 + basis_2q_fidelity[strength] = 1 - error # rewrite XX of the same strength in terms of it embodiment = XXEmbodiments[type(v)] if len(embodiment.parameters) == 1: