From e3b0ef17f3262e79c1bc7bc6893442ecfb1e631a Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Tue, 16 Apr 2013 22:35:31 -0700 Subject: [PATCH] Test for T808. --- tests/run/tp_new.pyx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/run/tp_new.pyx b/tests/run/tp_new.pyx index 8b99da2..45d1a03 100644 --- a/tests/run/tp_new.pyx +++ b/tests/run/tp_new.pyx @@ -1,3 +1,4 @@ +# ticket: 808 cimport cython @@ -30,6 +31,24 @@ class MyTypeSubClass(MyType): def __init__(self, *args, **kwargs): print "INIT" +# See ticket T808, vtab must be set even if there is no __cinit__. + +cdef class Base(object): + pass + +cdef class Derived(Base): + cpdef int f(self): + return 42 + +def test_derived_vtab(): + """ + >>> test_derived_vtab() + 42 + """ + cdef Derived d = Derived.__new__(Derived) + return d.f() + + # only these can be safely optimised: @cython.test_assert_path_exists('//PythonCapiCallNode') -- 2.7.4