python c-api: create bytes using existing buffer without copying python c-api: create bytes using existing buffer without copying python-3.x python-3.x

python c-api: create bytes using existing buffer without copying


The only way to do this is to create a new object with PyBufferProcs* PyTypeObject.tp_as_buffer. I checked cpython source code thoroughly, as of 3.4.1, there is no out-of-box (so to speak) solution.