[Python-3000] bug in py3k buffer object? (original) (raw)

Lisandro Dalcin dalcinl at gmail.com
Sat Sep 1 02:32:49 CEST 2007


Dear Travis, in my MPI wrappers, I use MPI_Alloc_mem function to get 'special' MPI memory, and next I return it to Python using

return PyBuffer_FromReadWriteMemory(ptr, len);

Well, getting back this rw-buffer in python, I tried to do

mem = MPI.Alloc_mem(10) mem[:] = str8('\0') * 8 # sort of memzero

but then I get this error:

Traceback (most recent call last): File "", line 1, in TypeError: buffer is read-only

I noticed you use PyBuff_SIMPLE in buffer_ass_item/buffer_ass_subscript... Is this OK? perhaps PyBuf_WRITEABLE is the right flag? No much more time to go deeper.

-- Lisandro Dalcín

Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594



More information about the Python-3000 mailing list