pybuffer

Creating a PyBuffer from a C struct

EDIT: Upon re-reading my original question I realized very quickly that it was very poorly worded, ambiguous, and too confusing to ever get a decent answer. That's what I get for rushing out a question at the end of my lunch break. Hopefully this will be clearer: I am trying to expose a simple C structure to Python (3.x) as a PyBuffer s...

Access contents of PyBuffer from C

I have created a buffer object in python like so: f = io.open('some_file', 'rb') byte_stream = buffer(f.read(4096)) I'm now passing byte_stream as a parameter to a C function, through SWIG. I have a typemap for converting the data which looks like this: %typemap(in) unsigned char * byte_stream { PyObject *buf = $input; //some...