Extern functions can't have default arguments. I've made this an
explicit error.

On Wed, Apr 22, 2015 at 1:07 PM, Michael Enßlin <mich...@ensslin.cc> wrote:
> Hi everybody,
>
> Cython 0.21.1, from Debian Sid, and Cython 0.22, from Gentoo, produce
> invalid C Code for the following .pyx file:
>
>
>
> $ cat test.pyx
> cimport cpython
>
> cdef extern from "test.h":
>     cdef void foo(int i = 0)
>
> def bar(self):
>     foo(0)
>
>
>
> $ cat test.h
> void foo(int i);
>
>
>
> $ cython test.pyx
>
>
>
> $ gcc -c test.c -I/usr/include/python3.4m
> test.c: In function ‘__pyx_pf_4test_bar’:
> test.c:659:35: error: storage size of ‘__pyx_t_1’ isn’t known
>    struct __pyx_opt_args_4test_foo __pyx_t_1;
>
>
>
> $ clang test.c -I/usr/include/python3.4m
> test.c:659:35: error: variable has incomplete type 'struct
> __pyx_opt_args_4test_foo'
>   struct __pyx_opt_args_4test_foo __pyx_t_1;
> test.c:659:10: note: forward declaration of 'struct
> __pyx_opt_args_4test_foo'
>   struct __pyx_opt_args_4test_foo __pyx_t_1;
>
>
>
> Note that this is a minimal example; removing anything from test.pyx
> fixes the issue (the 'cimport' statement, the default value for int i,
> and the call to foo). The issue also occurs with --cplus.
>
>
> Happy debugging,
>         mic_e
>
>
> _______________________________________________
> cython-devel mailing list
> cython-devel@python.org
> https://mail.python.org/mailman/listinfo/cython-devel
>
_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to