Boost logo

Boost :

From: Mike Ensor (MikeEnsor_at_[hidden])
Date: 2001-10-02 19:45:01


How can I switch a PyObject* in C into a void* varible? Is that possible?
if not, can I convert it into a char*? I am trying to get a "Buffer" object
in python and convert it into a void* type. I have no problem telling how
long it is, and extracting elements out of the "Buffer", but it returns
PyObject*'s out of the function call. I can print them out, but that does
nothing for me.

void ListAddEntry_Binary(e5_List&l, PyObject* pyObjRef)
{
  int size = PySequence_Size(pyObjRef);
  if(!PyBuffer_Check(pyObjRef))
  {
    std::cout << "PyObject is not a Buffer Object" << std::endl;
    return;
  }
  for(int i=0; i< size; i++)
  {
    std::cout << PySequence_GetItem(pyObjRef, i) << std::endl;
  }
}

that is the code I am currently working with.

Thank you,
Mike Ensor


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk