claus at slac.stanford.edu
Fri Mar 5 21:15:01 GMT 2004
Does PyBuffer_FromMemory make a copy of the passed in buffer? Does PyString_FromStringAndSize?
sipqtnetworkQSocket.cpp (generated from the .sip) appears to malloc, PyString_FromStringAndSize, free and then return the result. In my case, my buffer is small (32 bytes) so I tried creating it on the stack (in the sip code), called PyBuffer_FromMemory, returned the result and found junk in the result on the Python side. The solution I've used thus far has been to create the scratch buffer in Python, pass it in to the C++, PyBuffer_FromMemory it and return the result. Seems to work but is ugly. Is there a better way? Are sipMalloc and sipFree doing something behind the scenes that's not obvious?
More information about the PyQt