Changing the passed arguments value after returning from a module
Jean-Daniel Aussel
Jean-Daniel.Aussel at bull.net
Thu Jan 20 11:58:08 EST 2000
Hi there,
I'm trying to write a C module that changes the values of a passed argument,
which I am sure is a classic problem. The Python script would look as:
import mymodule
i=0
mymodule.test( i )
print i
where i would hold a meaningful value on return. Problem is I can't figure
out how to do it. This is my latest try, which still does not work:
static PyObject* sct_tt( PyObject* zself, PyObject* args)
{
PyObject* o;
int i;
if (!PyArg_ParseTuple(args, "O", o ))
return NULL;
PyTuple_SetItem(o, 0, PyInt_FromLong(101L));
if (PyErr_Occurred()) {
printf("kaboom!\n");
}
result=0;
return Py_BuildValue("i", result );
}
Any hints or help would be welcome. Regards,
/jda
More information about the Python-list
mailing list