[Cython] More concerns over extern ctypedefs

Stefan Behnel stefan_ml at behnel.de
Sun Jul 20 19:09:23 CEST 2008


Hi Dag,

Dag Sverre Seljebotn wrote:
> Consider this code:
> 
> cdef extern from "t.h":
>      ctypedef long hullo
> 
> def foo(hullo h): pass
> 
> I noticed that it creates code like this:
> PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "l", __pyx_argnames, 
> &__pyx_v_h))
> 
> Which could probably destroy the stack if we don't have the exact 
> typedef, right? Which means: One should either write our own parsing 
> code instead (generate for each parameter signature)

Robert and I were discussing to finish up the parameter unpacking code ages
ago and never really got down to it. We already have a lot of specialised code
for arg tuple unpacking and keyword checking. I think all that is missing is
an implementation for keyword unpacking and some code to prevent that
arguments are passed as both positional and keyword arguments.

The problem above might finally be a reason to do this. :)

Stefan


More information about the Cython-dev mailing list