A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2007-March/072352.html below:

[Python-Dev] An updated extended buffer PEP

[Python-Dev] An updated extended buffer PEP [Python-Dev] An updated extended buffer PEPGreg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 27 08:43:42 CEST 2007
Here's another idea, to allow multiple views of the same
buffer with different shape/stride info to coexist, but
without extra provider objects or refcount weirdness.
Also it avoids using calls with a brazillion arguments.

   struct bufferinfo {
     void **buf;
     Py_ssize_t *len;
     int *writeable;
     char **format;
     int *ndims;
     Py_ssize_t **shape;
     Py_ssize_t **strides;
     int **isptr;
   };

   int (*getbuffer)(PyObject *obj, struct bufferinfo *info);

   int (*releasebuffer)(PyObject *obj, struct bufferinfo *info);

If the object has constant shape/stride info, it just fills
in the info struct with pointers to its own memory, and does
nothing when releasebuffer is called (other than unlocking
its buffer).

If its shape/stride info can change, it mallocs memory for
them and copies them into the info struct. When releasebuffer
is called, it frees this memory.

It is the responsibility of the consumer to ensure that the
base object remains alive until releasebuffer has been called
on the info struct (to avoid leaking any memory that has
been malloced for shapes/strides).

--
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4