On 05/07/2012 06:04 PM, mark florisson wrote:
On 7 May 2012 12:10, Stefan Behnel<stefan...@behnel.de>  wrote:
Dag Sverre Seljebotn, 07.05.2012 12:40:
moving to dev list

Makes sense.

On 05/07/2012 11:17 AM, Stefan Behnel wrote:
Dag Sverre Seljebotn, 07.05.2012 10:44:
On 05/07/2012 07:48 AM, Stefan Behnel wrote:
I wonder why a memory view should be allowed to be None in the first
place.
Buffer arguments aren't (because they get unpacked on entry), so why
should memory views?

? At least when I implemented it, buffers get unpacked but the case of a
None buffer is treated specially, and you're fully allowed (and segfault if
you [] it).

Hmm, ok, maybe I just got confused by the code then.

I think the docs should state that buffer arguments are best used together
with the "not None" declaration then.

... which made me realise that that wasn't even supported. I can't believe
no-one ever reported that as a bug...

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

It's still not supported for memory views.

Yeah, that was never implemented, but probably should be.

BTW, is there a reason why we shouldn't allow a "not None" declaration for
cdef functions? Obviously, the caller would have to do the check in that
case.

Why can't the callee just check it? If it's None, just raise an
exception like usual?

It's just that there's a lot more potential for rather easy optimization if the caller does it.

Dag
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to