[ Note that there's a mailing list dedicated to the C API, http://mail.python.org/mailman/listinfo/capi-sig ]
Miki <[EMAIL PROTECTED]> 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. > if (NULL == defval) { > printf("no default\n"); > } > else { > str = PyString_AsString(defval); > printf("default is %s\n", str); > } Note that PyString_AsString expects a string; you should check that with PyString_Check. > 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;). -- http://mail.python.org/mailman/listinfo/python-list