DECREFing and PyArray functions in C Extensions
Louis M. Pecora
pecora at anvil.nrl.navy.mil
Mon May 29 08:02:12 EDT 2000
In article <ya0hfbig5g7.fsf at trymheim.ifi.uio.no>, Roger Hansen
<rogerha at ifi.uio.no> wrote:
> static PyObject *
> foo(PyObject *self, PyObject* args)
> {
> PyArrayObject *array;
> double* a; /* C ptr to the NumPy array data field */
>
> if (!PyArg_ParseTuple(args, "O!", &PyArray_Type, &array)) {
> return NULL; /* Error indicator */
> }
[cut]
>
> Py_INCREF(Py_None); return Py_None;
> }
>
> where f is some function. I don't need to DECREF array in this
> example since PyArg_ParseTuple does not increase the reference count,
> right?
That looks right to me, but what is this:
Py_INCREF(Py_None); return Py_None;
What's going on there with Py_None?
More information about the Python-list
mailing list