[PyQt] Access to QSharedMemory with buffer protocol

Giovanni Bajo rasky at develer.com
Tue Nov 2 10:26:46 GMT 2010


On mar, 2010-11-02 at 10:16 +0000, Phil Thompson wrote:
> On Tue, 2 Nov 2010 00:00:06 +0200, "Hans-Peter Jansen" <hpj at urpla.net>
> wrote:
> > Hi Phil,
> > 
> > end of July last year, Alexandre Raczynski asked about accessing 
> > QSharedMemory, and you replied, that:
> > 
> > mutable_data = buffer(sharedMemory.data())
> > 
> > ...should give _write_ access to the memory.
> 
> ...bad advice. I didn't realise that you can't create mutable buffers from
> Python. (Although there is no reason why you shouldn't be able to.)

Actually, Python 2.7 has memoryview(); if
memoryview(sharedMemory.data()) worked, it would be possible to use
memoryview's method to mutate the buffer, without having to come up with
a different API for sip.voidptr.
-- 
Giovanni Bajo      ::  Develer S.r.l.
rasky at develer.com  ::  http://www.develer.com

Blog: http://giovanni.bajo.it
Last post: Compile-time Function Execution in D



More information about the PyQt mailing list