diff options
Diffstat (limited to 'tests/run/cdef_multiple_inheritance.pyx')
-rw-r--r-- | tests/run/cdef_multiple_inheritance.pyx | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/tests/run/cdef_multiple_inheritance.pyx b/tests/run/cdef_multiple_inheritance.pyx index 4213d35d3..0f8eaef24 100644 --- a/tests/run/cdef_multiple_inheritance.pyx +++ b/tests/run/cdef_multiple_inheritance.pyx @@ -1,3 +1,5 @@ +cimport cython + cdef class CBase(object): cdef int a cdef c_method(self): @@ -9,7 +11,8 @@ class PyBase(object): def py_method(self): return "PyBase" -cdef class Both(CBase, PyBase): +@cython.binding(True) +cdef class BothBound(CBase, PyBase): cdef dict __dict__ """ >>> b = Both() @@ -32,7 +35,7 @@ cdef class Both(CBase, PyBase): def call_c_method(self): return self.c_method() -cdef class BothSub(Both): +cdef class BothSub(BothBound): """ >>> b = BothSub() >>> b.py_method() @@ -43,3 +46,27 @@ cdef class BothSub(Both): 'Both' """ pass + +@cython.binding(False) +cdef class BothUnbound(CBase, PyBase): + cdef dict __dict__ + """ + >>> b = Both() + >>> b.py_method() + 'PyBase' + >>> b.cp_method() + 'Both' + >>> b.call_c_method() + 'Both' + + >>> isinstance(b, CBase) + True + >>> isinstance(b, PyBase) + True + """ + cdef c_method(self): + return "Both" + cpdef cp_method(self): + return "Both" + def call_c_method(self): + return self.c_method() |