Question about extending the interperter

Eli elie at flashmail.com
Mon May 9 12:03:13 EDT 2005


Hi,
I've followed the Python docs about extending the Python interperter
and created an extension library.
I've added my functions like this:

static PyMethodDef pmylib_methods[] = {
{"foo", pmylib_foo, METH_VARARGS, "foo() doc string"},
...
}
static PyObject *pmylib_foo(PyObject *self, PyObject *args)
{
...
	char *p;
	if (!PyArg_ParseTuple(args, "s", &p))
...
}

And that's works fine.
The problem for me is that the pointer "p" in the last function points
to the arguments:
If a user caller foo("123") - p points to '123'.
What I need is to point it to the whole string received - 'foo
("123")'.

Is there a way I can do this?

Thanks in advance,
Eli




More information about the Python-list mailing list