PyListObject & C Modules

Martin v. Löwis loewis at informatik.hu-berlin.de
Wed Sep 4 12:44:17 EDT 2002


jggramlich at yahoo.com (Joshua Gramlich) writes:

> get_first_elem(PyObject *unused, PyObject *args)
> {
>   if(!PyArg_ParseTuple("!0", &list))
>     return NULL;
> slist.c:10: warning: passing arg 1 of `PyArg_ParseTuple' from
> incompatible pointer type

Right. This should be
   if(!PyArg_ParseTuple(args,"!0", &list))
     return NULL;

Reading the Extending and Embedding tutorial would have helped you to
fix this error on your own.

>   Py_ADDREF(first);
> ./slist.so: symbol Py_ADDREF: referenced symbol not found

Right. It is INCREF, not ADDREF. Reading the tutorial really helps.

You'll also learn that you lead additional boilerplate code to make an
extension module.

Regards,
Martin



More information about the Python-list mailing list