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
Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
Make sure you've read the documentation. Your issue may be addressed there.
Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
If possible, make a PR with a failing test to give us a starting point to work on!
Describe the bug
When importing OrderedDict from the collections module in Python, any attempt to define or use a @cudaq.kernel results in an AttributeError. This appears to be a conflict between cudaq and the standard Python library, specifically the collections module. The issue makes it impossible to use OrderedDict alongside cudaq, which could affect projects relying on both.
Steps to reproduce the bug
import cudaq
from collections import OrderedDict
# Define our kernel.
@cudaq.kernel
def kernel(qubit_count: int):
# Allocate our qubits.
qvector = cudaq.qvector(qubit_count)
# Place the first qubit in the superposition state.
h(qvector[0])
# Loop through the allocated qubits and apply controlled-X,
# or CNOT, operations between them.
for qubit in range(qubit_count - 1):
x.ctrl(qvector[qubit], qvector[qubit + 1])
# Measure the qubits.
mz(qvector)
Expected behavior
The script should execute without errors, as importing OrderedDict from collections is a standard Python operation.
Instead, it fails with the following error:
AttributeError: type object 'collections.OrderedDict' has no attribute '__annotations__'
Is this a regression? If it is, put the last known working version (or commit) here.
Required prerequisites
Describe the bug
When importing
OrderedDict
from thecollections
module in Python, any attempt to define or use a@cudaq.kernel
results in anAttributeError
. This appears to be a conflict betweencudaq
and the standard Python library, specifically thecollections
module. The issue makes it impossible to useOrderedDict
alongsidecudaq
, which could affect projects relying on both.Steps to reproduce the bug
Expected behavior
The script should execute without errors, as importing
OrderedDict
fromcollections
is a standard Python operation.Instead, it fails with the following error:
AttributeError: type object 'collections.OrderedDict' has no attribute '__annotations__'
Is this a regression? If it is, put the last known working version (or commit) here.
No response
Environment
Suggestions
No response
The text was updated successfully, but these errors were encountered: