Thomas Heller wrote:
Lifetimes are managed by refcounts, so it's a refcount issue, at least as long as every object exposing the buffer interface _guarantees_ that the memory address and size does not change. (Which does not seem the case for array objects).
Thomas, please first explain what you want to *do* with the buffer interface. Some of the buffer API was a mistake. It *appears* to be an interface for allocating and managing buffers, while in actuality it is only intended to provide access to buffered data that is managed by some C code. You're probably better off using the array module to manage buffers.
I want to expose memory blocks to C, wrapped in python objects/classes. These memory blocks could come from builtin python types: strings, unicode strings, array objects, mmap'd files, ...
If you are talking about a memory object, then I'm in agreement with you, Thomas. I'd like to see a memory object that allocates and deallocates blocks of memory and exports a pointer to its memory. It could also set privileges such are read/write, etc. Its interface would be identical, or at least similar, to the mmap object, so that they could be easily interchanged. -- Dr. Paul Barrett Space Telescope Science Institute Phone: 410-338-4475 ESS/Science Software Group FAX: 410-338-4767 Baltimore, MD 21218