more python to c/c++ questions.

Jr. King n at n.com
Mon Jun 7 13:05:21 EDT 1999


Ok, I found some info on it but, it still doesn't work

I changed my c module to this...
<snip>
static PyObject* objPass(PyObject *self, PyObject* args){
    PyObject *result = NULL;
    PyObject *temp;

    if (PyArg_ParseTuple(args, "O", &temp)) {
   PyObject* xarg = Py_BuildValue("(s)","i");
   xarg = PyObject_GetAttr(temp,xarg);  // not getting anything but null
   int val;
   PyArg_ParseTuple(xarg,"i",&val);
 }
    Py_INCREF(Py_None);
    result = Py_None;
    return result;
}

Python module snippet

class Cow:
 i = 10
 x = 0
 str = "string"
 def genie(self):
  print str

testmeth.setCallback(setN)
testmeth.testmeth(13,9)
cow = Cow()
testmeth.objpass(cow);

Thanks
jamarijr at liam_toh.com
                 ^hotmail...  Must spoil spammers







More information about the Python-list mailing list