From 21da5e3eb295e3a3cfa0fee73c06371ef933b010 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 10:14:28 +0200 Subject: [PATCH] adding copy argument to __array__ (#12979) (#12987) (cherry picked from commit 06392c523fdc514d2592ffc489e7a3515049eba3) Co-authored-by: Alexander Ivrii --- qiskit/circuit/library/basis_change/qft.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qiskit/circuit/library/basis_change/qft.py b/qiskit/circuit/library/basis_change/qft.py index 2ec6dd69cb79..15668ec51e11 100644 --- a/qiskit/circuit/library/basis_change/qft.py +++ b/qiskit/circuit/library/basis_change/qft.py @@ -315,8 +315,10 @@ def __init__( """ super().__init__(name="qft", num_qubits=num_qubits, params=[]) - def __array__(self, dtype=complex): + def __array__(self, dtype=complex, copy=None): """Return a numpy array for the QFTGate.""" + if copy is False: + raise ValueError("unable to avoid copy while creating an array as requested") n = self.num_qubits nums = np.arange(2**n) outer = np.outer(nums, nums)