thanks for your help,the following demo is the example resault in cython coredump.(that's the reason why i want cython to call function by
__Pyx_PyObject_GetAttrStr)
-------------------------------------file test_module.py--------------------------------------------------------------------
import test_class_a
class B(object):
def do_B(self):
setattr(B, "A_method_2", test_class_a.A.A_method_2.im_func)
test_class_a.A.A_method_1.im_func(self) # cython will coredump in this line
b=B()
b.do_B()
--------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------- file test_class_a.py---------------------------------------------------------------------------
class A(object):
def A_method_1(self):
self.A_method_2()
def A_method_2(self):
pass
------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------- file test_class_a.pxd-------------------------------------------------------------------------------
cdef class A(object):
cpdef A_method_2(self)
---------------------------------------------------------------------------------------------------------------------------------------------------
why demo is so obscure ? in our project, we have too many moudles like class A,however , we want them become part of class B(because we dont want class B moudle's code too long) by method like do_B, so we did like demo.
my purpose is to speed up class A and not to croedump
thanks for your help again