Image Module Bug
Richard Oudkerk
oudkerk at ma.man.ac.uk
Wed Jul 21 10:13:47 EDT 2004
I had this problem too a week ago. You should use "s#" with
PyArg_ParseTuple instead of "s". See
http://www.python.org/doc/1.5.2p2/ext/parseTuple.html
So instead of doing something like:
static PyObject *
spam_something(PyObject *self, PyObject *args) {
char *string;
if (!PyArg_ParseTuple(args, "s", &string))
return NULL;
you do this:
static PyObject *
spam_something(PyObject *self, PyObject *args)
char *string;
int length;
if (!PyArg_ParseTuple(args, "s#", &string, &length))
return NULL;
'length' will be length of the string passed from python.
Richard
More information about the Python-list
mailing list