PyArg_ParseTuple() & Py_DECREF()
Alex Farber
farber at cpan.org
Sat Mar 4 10:05:27 EST 2000
Fredrik Lundh wrote:
> Ralf wrote:
> > Consider the following two lines of source code at the
> > beginning of a C extension function:
> >
> > PyObject *O;
> > if (! PyArg_ParseTuple(args, "O", &O)) return NULL;
> >
> > Is it necessary to call Py_DECREF(O) before leaving the
> > extension function?
>
> no. PyArg_ParseTuple returns borrowed references.
Do you have to call free(str) after
PyArg_ParseTuple (val, "sO", &str, &obj)?
Where is str stored? Will it be overwritten after
calling PyArg_ParseTuple (val, "sO", &str2, &obj)?
Regards
Alex
More information about the Python-list
mailing list