Skip to content

[python, run] Creating data classes with constructors generates empty return #3085

@annagrin

Description

@annagrin

Required prerequisites

  • 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

Creating data classes with constructors generates empty return

Steps to reproduce the bug

@dataclass
class MyClass:
    def __init__(self, i):
        self.x = i

@cudaq.kernel
def bugSP2() -> MyClass:
    return MyClass(-13)

print(cudaq.run(bugSP2, shots_count = 2))

Output:
[]

Expected behavior

Error if an __init__ is defined in a data class.

Is this a regression? If it is, put the last known working version (or commit) here.

Not a regression

Environment

  • CUDA-Q version:
  • Python version:
  • C++ compiler:
  • Operating system:

Suggestions

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions