也许我做错了很明显的事情,但是即使在这个简单的示例中,我也无法从其他类型派生扩展类型:
$ cat a.pyx
from b.py import MyClass
cdef class NewClass(MyClass):
pass
$ cat b.pyx
class MyClass(object):
def __init__(self):
print("HELLO")
$ cythonize3 a.pyx
Compiling /home/jonas/test/a.pyx because it changed.
[1/1] Cythonizing /home/jonas/test/a.pyx
Error compiling Cython file:
------------------------------------------------------------
...
from b.py import MyClass
cdef class NewClass(MyClass):
^
------------------------------------------------------------
a.pyx:4:20: First base of 'NewClass' is not an extension type
Traceback (most recent call last):
File "/usr/bin/cythonize3", line 11, in <module>
load_entry_point('Cython==0.28.4', 'console_scripts', 'cythonize')()
File "/usr/lib64/python3.6/site-packages/Cython/Build/Cythonize.py", line 196, in main
cython_compile(path, options)
File "/usr/lib64/python3.6/site-packages/Cython/Build/Cythonize.py", line 90, in cython_compile
**options.options)
File "/usr/lib64/python3.6/site-packages/Cython/Build/Dependencies.py", line 1026, in cythonize
cythonize_one(*args)
File "/usr/lib64/python3.6/site-packages/Cython/Build/Dependencies.py", line 1146, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: /home/jonas/test/a.pyx
有人知道我在做什么错吗?由于某种原因不支持此操作吗?