G
garyjefferson123
I want to accept a cStringIO object in a function in a python extension
module. How do I do this?
e.g.,
static PyObject *myfunc(PyObject *self, PyObject *args)
{
PyObject *cstringio;
if (!PyArg_ParseTuple(args, "O:cStringIO", &cstringio)) {
PyErr_SetString(PyExc_ValueError,
"value must be a cstringio");
return NULL;
}
/* how to get at the data buffer or call read() on cstringio? */
}
I understand that I probably want PyEval_CallObject(), but I don't know
how to get at the read() method of cstringio.
Thanks,
Gary
module. How do I do this?
e.g.,
static PyObject *myfunc(PyObject *self, PyObject *args)
{
PyObject *cstringio;
if (!PyArg_ParseTuple(args, "O:cStringIO", &cstringio)) {
PyErr_SetString(PyExc_ValueError,
"value must be a cstringio");
return NULL;
}
/* how to get at the data buffer or call read() on cstringio? */
}
I understand that I probably want PyEval_CallObject(), but I don't know
how to get at the read() method of cstringio.
Thanks,
Gary