We have a very small extension function which creates writeable buffer objects using the buffer type C-API.
That's how the buffer API was supposed to be used.
We also wrap suitable type instances with a "buffer object wrapper". I'm slowly gathering that this is unsafe. :-(
I don't understand what you say, but I believe you.
Maybe instead of the buffer() function/type, there should be a way to allocate raw memory?
Yes. It would also be nice to be able to:
- Know (at the python level) that a type supports the buffer C-API.
Good idea. (I guess right now you can see if calling buffer() with an instance as argument works. :-)
- Copy bytes from one buffer to another (writeable buffer).
Maybe you would like to work on a requirements gathering for a memory object?
--Guido van Rossum (home page: http://www.python.org/%7Eguido/)