On Thu, Jun 11, 2015 at 10:09 AM Michael Enßlin <mich...@ensslin.cc> wrote:
> Hi guys, > > have a look at this: > > $ cat bar.pyx > cdef extern from "foo.h": > cdef cppclass Foo: > int operator() (int arg) > int do_call (int arg) > > > cdef int bar(int arg): > cdef Foo foo > foo.do_call(arg) > return foo(arg) > > $ cython3 --cplus bar.pyx > $ cat bar.cpp > > (...) > > static int __pyx_f_3bar_bar(int __pyx_v_arg) { > Foo __pyx_v_foo; > int __pyx_r; > __Pyx_RefNannyDeclarations > __Pyx_RefNannySetupContext("bar", 0); > > /* "bar.pyx":9 > * cdef int bar(int arg): > * cdef Foo foo > * foo.do_call(arg) # <<<<<<<<<<<<<< > * return foo(arg) > */ > __pyx_v_foo.do_call(__pyx_v_arg); > > /* "bar.pyx":10 > * cdef Foo foo > * foo.do_call(arg) > * return foo(arg) # <<<<<<<<<<<<<< > */ > __pyx_r = operator()(__pyx_v_arg); > goto __pyx_L0; > > /* "bar.pyx":7 > * > * > * cdef int bar(int arg): # <<<<<<<<<<<<<< > * cdef Foo foo > * foo.do_call(arg) > */ > > /* function exit code */ > __pyx_L0:; > __Pyx_RefNannyFinishContext(); > return __pyx_r; > } > > (...) > > > > Note how the function invocation for "do_call" is generated correctly, > but the invocation of operator() is nonsensical. > > The correct line would be this: > > __pyx_r = __pyx_v_foo(__pyx_v_arg); > > Happy debugging :D > > ~ mic_e > > _______________________________________________ > cython-devel mailing list > cython-devel@python.org > https://mail.python.org/mailman/listinfo/cython-devel There was a patch for this in https://mail.python.org/pipermail/cython-devel/2015-February/004328.html. I'm not sure what ever became of it though. I wrote up a workaround on SO at http://stackoverflow.com/a/25955546/1935144 a while ago. Best of luck! -Ian Henriksen
_______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel