You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Serialization decoding of a circuit with qpy fails when qargs for a delay are passed in as a set and len(qargs) > 1. The error raised here is
ValueError: b'\x00' is not a valid Value
and when running the circuit on a device, the job will fail with something like:
Failed - UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 87: invalid start byte
How can we reproduce the issue?
from qiskit import QuantumCircuit, qpy
# This case fails when the delay is present
num_qubits = 2
qubits = {0, 1}
# This case always runs
#num_qubits = 1
#qubits = {0}
qc = QuantumCircuit(num_qubits)
qc.delay(duration=160, qarg=qubits)
qc.x(qubits)
with open("test.qpy", "wb") as f:
qpy.dump(qc, f)
with open("test.qpy", "rb") as f:
qpy.load(f)
What should happen?
This should run regardless of the cases described.
Any suggestions?
No response
The text was updated successfully, but these errors were encountered:
This is a bug with QuantumCircuit.delay rather than QPY - it's the same thing as #11208 going on, where the initial QuantumCircuit is in a totally invalid state that's somehow not noticed. It's because of our old "friend" broadcasted arguments.
As an immediate work-around, turn the set into a list and the circuit will be valid (and roundtrip through QPY, etc).
Environment
0.45.1
3.10.12
13.6 (22G120)
What is happening?
Serialization decoding of a circuit with
qpy
fails whenqargs
for adelay
are passed in as aset
andlen(qargs) > 1
. The error raised here isand when running the circuit on a device, the job will fail with something like:
How can we reproduce the issue?
What should happen?
This should run regardless of the cases described.
Any suggestions?
No response
The text was updated successfully, but these errors were encountered: