Commit 63741b75 authored by scoder's avatar scoder

Merge pull request #214 from robertwb/T808

T808
parents dba22361 e3b0ef17
......@@ -339,7 +339,8 @@ class ConstructorSlot(InternalMethodSlot):
self.method = method
def slot_code(self, scope):
if scope.parent_type.base_type \
if self.slot_name != 'tp_new' \
and scope.parent_type.base_type \
and not scope.has_pyobject_attrs \
and not scope.lookup_here(self.method):
# if the type does not have object attributes, it can
......
# 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')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment