| 1 |
# Test for https://github.com/cython/cython/issues/4106 |
| 2 |
|
| 3 |
PYTHON setup.py build_ext --inplace |
| 4 |
PYTHON -c "import sub" |
| 5 |
|
| 6 |
######## setup.py ######## |
| 7 |
|
| 8 |
from Cython.Build import cythonize |
| 9 |
from distutils.core import setup |
| 10 |
|
| 11 |
setup( |
| 12 |
ext_modules = cythonize("*.pyx"), |
| 13 |
) |
| 14 |
|
| 15 |
######## base.pxd ######## |
| 16 |
|
| 17 |
cdef class A: |
| 18 |
cdef dict __dict__ |
| 19 |
cdef int a(self) |
| 20 |
|
| 21 |
cdef class B(A): |
| 22 |
cdef int b(self) |
| 23 |
|
| 24 |
######## base.pyx ######## |
| 25 |
|
| 26 |
cdef class A: |
| 27 |
cdef int a(self): |
| 28 |
return 1 |
| 29 |
|
| 30 |
class PyA: |
| 31 |
pass |
| 32 |
|
| 33 |
cdef class B(A, PyA): |
| 34 |
cdef int b(self): |
| 35 |
return 2 |
| 36 |
|
| 37 |
######## sub.pyx ######## |
| 38 |
|
| 39 |
from base cimport B |
| 40 |
print(B) |
| 41 |
|
| 42 |
cdef class C(B): |
| 43 |
cdef int c(self): |
| 44 |
return 3 |