[Python-Dev] buffer interface for C extensions

Dan Lenski dlenski at gmail.com
Thu May 22 23:25:09 CEST 2008


On Thu, 22 May 2008 23:10:09 +0200, M.-A. Lemburg wrote:

> On 2008-05-19 00:59, Dan Lenski wrote:
> You should probably ask such questions on the capi-sig list.
> 
> To answer your question:
> 
> t# requires support for the read-only 8-bit character buffer interface
> s# can use the read buffer interface
> w# requires support for the write buffer interface

I somehow overlooked the fact that the "s#" argument specifier supports 
exactly the functionality that I need.  D'oh!

> Those are two different buffer interface slots, so whether a particular
> object works with t# or w# depends on whether it implements the slots in
> question.
> 
> You should probably try s#, as this will also work with objects that
> implement the getreadbuffer slot.

Worked like a charm!

> The details can be found in Python/getargs.c

I'm still unclear on the difference between the character/read buffer 
interfaces, but I'll read the code and try and figure that out.  Thanks 
for your help, Marc-Andre!!!

Dan



More information about the Python-Dev mailing list