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
signature.asc
Description: OpenPGP digital signature
_______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel