> 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.
Great, thanks!
> > I'm try to write the C equivalent of:
>
> Use PyArg_ParseTupleAndKeywords() to parse the args and kwargs objects.
Couldn't figure out how to get *args with ParseTupleAndKeywords.
Thanks,
Miki
--
http://mail.python.org/mailman/listinfo/python-list
[ 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
Miki wrote:
> I'm try to write the C equivalent of:
>
> def kw(*args, **kw):
> print "%d args" % len(args),
> if "default" in kw:
> print "default is %s" % kw["default"]
> else:
> print "no default"
Consider using Cython instead, it will make your life a lot easier. Th
Miki wrote:
Hello All,
I'm try to write the C equivalent of:
Use PyArg_ParseTupleAndKeywords() to parse the args and kwargs objects.
Christian
--
http://mail.python.org/mailman/listinfo/python-list
Hello All,
I'm try to write the C equivalent of:
def kw(*args, **kw):
print "%d args" % len(args),
if "default" in kw:
print "default is %s" % kw["default"]
else:
print "no default"
I've written:
static PyObject *
kw(PyObject *self, PyObject *args, PyObject *kwds) {