[Cython] a C++ wrapping wishlist

2015-05-21 Thread Stefan Behnel
Someone wrote a list of shortcomings after wrapping some C++ code:

http://blog.marcus-brinkmann.de/2014/07/31/cython-trouble/

A couple of these issues are due to misunderstandings (specifically the
"imports" section) or now-fixed bugs (post is almost a year old), but it
seems that some of them are still valid and might be low-hanging fruit.

Stefan
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


[Cython] Broken link to CEP 516

2015-05-21 Thread Jeroen Demeyer

At
http://docs.cython.org/src/reference/compilation.html#compiler-directives
there are two links to "CEP 516" but they are broken.

Jeroen.
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Broken link to CEP 516

2015-05-21 Thread Stefan Behnel
Jeroen Demeyer schrieb am 21.05.2015 um 14:21:
> http://docs.cython.org/src/reference/compilation.html#compiler-directives
> there are two links to "CEP 516" but they are broken.

Thanks. The problem seems to be an incorrect redirect to
"github.../wikienhancements/" instead of "github.../wiki/enhancements/".

I don't know how the setup is done here, but Robert should know.

Stefan

___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Misleading error message when assigning function pointers with differing except* declarations

2015-05-21 Thread Stefan Behnel
Michael Enßlin schrieb am 07.05.2015 um 15:13:
> consider the following example:
> 
> $ cat demo.pyx
> cdef void (*foo)()
> 
> cdef void bar() except*:
> pass
> 
> foo = bar
> 
> 
> 
> $ cython demo.pyx
> 
> Error compiling Cython file:
> 
> ...
> cdef void (*foo)()
> 
> cdef void bar() except*:
> pass
> 
> foo = bar
> ^
> 
> 
> demo.pyx:6:9: Cannot assign type 'void (void)' to 'void (*)(void)'
> 
> this is all expected behavior, but the error message is entirely
> misleading; it should be something like
> 
> demo.pyx:6:9: Function pointers have incompatible 'except *' declarations.

Thanks for the report. I think displaying "except *" as part of the
function type would make this clear enough, i.e. you'd get

Cannot assign type 'void (void) except *' to 'void (*)(void)'

https://github.com/cython/cython/commit/937f83149eaf979850faa25f62857e29726c11a6

Stefan

___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython generates invalid C code for some generator expressions in cdef functions

2015-05-21 Thread Stefan Behnel
Michael Enßlin schrieb am 08.05.2015 um 14:37:
> Take the following example:
> 
> 
> $ cat t2.pyx
> cdef void read_callback():
> foo = b"asdf"
> bar = (c for c in foo)
> 
> 
> 
> $ cython t2.pyx
> 
> 
> 
> $ gcc -I/usr/include/python3.4m t2.c
> t2.c: In function ‘__pyx_f_2t2_read_callback’:
> t2.c:778:12: error: ‘None’ undeclared (first use in this function)
>  return None;
> ^
> t2.c:778:12: note: each undeclared identifier is reported only once for
> each function it appears in
> t2.c:778:5: warning: ‘return’ with a value, in function returning void
>  return None;
>  ^
> 
> 
> Note that the error does not occur for
> 
> bar = (c for c in b"asdf")
> 
> or
> 
> bar = [c for c in b"asdf"]

Thanks for the report. This should fix it:

https://github.com/cython/cython/commit/f8b952c16dc569e50642d426e328d2d0fe0f53aa

Stefan

___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] a C++ wrapping wishlist

2015-05-21 Thread Ian Henriksen
On Thu, May 21, 2015 at 2:13 AM Stefan Behnel  wrote:

> Someone wrote a list of shortcomings after wrapping some C++ code:
>
> http://blog.marcus-brinkmann.de/2014/07/31/cython-trouble/
>
> A couple of these issues are due to misunderstandings (specifically the
> "imports" section) or now-fixed bugs (post is almost a year old), but it
> seems that some of them are still valid and might be low-hanging fruit.
>
> Stefan
> ___
> cython-devel mailing list
> cython-devel@python.org
> https://mail.python.org/mailman/listinfo/cython-devel


That's a very well-thought-out list. Overloading assignment and
defining custom type coercions would be useful features to have.
An idiomatic way of writing signatures for variadic templates and
letting functions returning references be used as left-values are
two other things that would be very nice to see.
Thanks!
-Ian Henriksen
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel