Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning None is not supported kernel functions #1657

Open
4 tasks done
annagrin opened this issue May 10, 2024 · 2 comments
Open
4 tasks done

Returning None is not supported kernel functions #1657

annagrin opened this issue May 10, 2024 · 2 comments
Labels
python bridge Involves the python bridge to quake
Milestone

Comments

@annagrin
Copy link
Collaborator

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

Does not work

import cudaq
import numpy as np

@cudaq.kernel
def test_k() -> complex:
    return None

print(test_k()) # cudaq.kernel.ast_bridge.CompilerError: program.py:14: error: unhandled constant value (offending source -> None)

#Works

def test() -> complex:
    return None

print(test())

Steps to reproduce the bug

import cudaq
import numpy as np

@cudaq.kernel
def test_k() -> complex:
    return None

print(test_k())

Expected behavior

None is printed

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

Not a regression

Environment

  • CUDA Quantum version:
  • Python version:
  • C++ compiler:
  • Operating system:

Suggestions

No response

@schweitzpgi
Copy link
Collaborator

Do we expect this to generate something or should the bridge give a syntax error?

@bettinaheim
Copy link
Collaborator

We need a spec for what valid return values are in Python after the 0.7.0 update.

@bettinaheim bettinaheim added this to the release 0.8.0 milestone Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python bridge Involves the python bridge to quake
Projects
None yet
Development

No branches or pull requests

3 participants