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

Pxd support of fused types #3204

Closed
thautwarm opened this issue Oct 24, 2019 · 2 comments
Closed

Pxd support of fused types #3204

thautwarm opened this issue Oct 24, 2019 · 2 comments

Comments

@thautwarm
Copy link

Currently, while

from cython cimport fused_type
cdef fused Num:
   int
   float
cpdef num_func(Num x)

produces a Cython compiler error, and follow codes can be a workaround:

from cython cimport fused_type
Num = fused_type(int, float)
cpdef num_func(Num x)

Post it here for it could be helpful for many, and no doubt can be regarded as a bug.

@will-ca
Copy link
Contributor

will-ca commented Feb 13, 2020

Under language_level 3 with language "c++", I've been able to define fused types in the .pxd file just fine, without having even having a from cython cimport fused_type statement.

@scoder
Copy link
Contributor

scoder commented Feb 14, 2020

I cannot reproduce this.

test.pyx:

cpdef num_func(Num x): return

test.pxd:

from cython cimport fused_type  # unused code, can be deleted
cdef fused Num:
   int
   float
cpdef num_func(Num x)

@scoder scoder closed this as completed Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants