[Cython] Fused types don't work with cdef classes?
Dave Hirschfeld
dave.hirschfeld at gmail.com
Fri Feb 8 17:54:28 CET 2013
Is this a bug?
The following code fails to compile on windows VS2012, 32bit Python2.7 with a
recent 0.19-pre github cython:
cimport cython
ctypedef fused char_or_float:
cython.char
cython.float
cdef class FusedExample:
def __init__(self, char_or_float x):
pass
#
Resulting in the following exception:
C:\temp>C:\dev\bin\Python27\python.exe setup.py build_ext --inplace --
compiler=msvc
Compiling example.pyx because it changed.
Cythonizing example.pyx
running build_ext
building 'example' extension
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\cl.exe
/c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I.
-IC:\dev\code\Gazprom.MT\pricing\gazprom\mt\pricing
-IC:\dev\bin\Python27\lib\site-packages\numpy\core\include
"-IC:\dev\lib\Intel\Composer XE 2013\mkl\include"
-IC:\dev\bin\Python27\include
-IC:\dev\bin\Python27\PC
/Tp example.cpp
/Fobuild\temp.win32-2.7\Release\example.obj
/EHsc /openmp
example.cpp
example.cpp(1630) : error C2062: type 'int' unexpected
example.cpp(1630) : error C2143: syntax error : missing ';' before '{'
example.cpp(1630) : error C2447: '{' : missing function header (old-style formal
list?)
example.cpp(1687) : error C2062: type 'int' unexpected
example.cpp(1687) : error C2143: syntax error : missing ';' before '{'
example.cpp(1687) : error C2447: '{' : missing function header (old-style formal
list?)
example.cpp(3869) : error C2440: 'initializing' : cannot convert
from 'PyObject *(__cdecl *)(PyObject *,PyObject *,PyObject *)' to
'initproc'
None of the functions with this name in scope match the target type
error: command '"C:\Program Files (x86)\Microsoft Visual Studio
11.0\VC\BIN\cl.exe"'
failed with exit status 2
If the cdef is removed from the class it compiles fine. Are fused types supposed
to work with cdef classes?
Thanks,
Dave
More information about the cython-devel
mailing list