Problems with PyArg_ParseTuple

Jeff Collins collins at seal.aero.org
Mon Mar 27 12:22:36 EST 2000


Try using "O" instead of "o".

Jeff

lss at excosoft.se writes:
 > 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.
 > -- 
 > http://www.python.org/mailman/listinfo/python-list
 > 




More information about the Python-list mailing list