Problems with PyArg_ParseTuple

lss at excosoft.se lss at excosoft.se
Mon Mar 27 10:51:05 EST 2000


I'm trying to use PyArg_ParseTuple's "o" format unit, i.e. to parse an
incoming argument as a plain PyObject pointer. However, every time, I
get a TypeError. Below is a code excerpt.
extern "C" static PyObject*
python_getScreen(PyObject* pSelf, PyObject* args)
{
PyObject* referrer;
void* refereeAddr = NULL;
if (!PyArg_ParseTuple(args, "o", &referrer)) {
return NULL;
}
refereeAddr = screen.registerReferrer(referrer);
return PyInt_FromLong((long)refereeAddr);
}
I've also tried passing the "referrer" pointer directly to
PyArg_ParseTuple, instead of its address, but it makes no difference.
Can anyone tell me what I'm doing wrong? The method is called by an
ordinary Python instance object, with "self" as the sole argument.
Thankful for any assistance...
--
Ludvig Svenonius


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list