[Python-Dev] PEP 3118: Extended buffer protocol (new version)
Lisandro Dalcin
dalcinl at gmail.com
Fri Apr 13 16:05:41 CEST 2007
On 4/13/07, Travis Oliphant <oliphant.travis at ieee.org> wrote:
> >> int PyObject_GetContiguous(PyObject *obj, void **buf, Py_ssize_t
> >> *len,
> >> int fortran)
> >>
> >> Return a contiguous chunk of memory representing the buffer. If a
> >> copy is made then return 1. If no copy was needed return 0.
> >
> > 8) If a copy was made, What should consumers call to free memory?
>
> You are right. We need a free function.
>
I think now the memory perhaps should be allocated with PyMem_New and
deallocated with PyMem_Free.
Additionally, the return should perhaps indicate success or failure,
and a new argument should be passed in order to know if a copy was
made, something like
int PyObject_GetContiguous(PyObject *obj,
void **buf, Py_ssize_t
*len, int *copy,
char layout)
--
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-Dev
mailing list