C API with *args and **kw
Miki
miki.tebeka at gmail.com
Tue Oct 14 17:05:06 EDT 2008
> Miki <miki.teb... at gmail.com> writes:
> > However when running the test:
> > from kw import kw
> > kw(default="2")
> > kw(1)
> > kw()
>
> > I get "bus error" on the 2'nd call (OS X Python 2.5.2).
>
> When called without keywords, kwds is NULL. You need to handle that
> case explicitly.
Great, thanks!
> > return Py_BuildValue("");
>
> The equivalent of your Python code would be to return None using
> Py_RETURN_NONE (sugar for Py_INCREF(Py_None); return Py_None;).
OK, Thanks.
More information about the Python-list
mailing list