[Python-Dev] buffer interface for C extensions (original) (raw)

Dan Lenski dlenski at gmail.com
Tue May 20 01:32:38 CEST 2008


On Sun, 18 May 2008 22:59:05 +0000, Dan Lenski wrote:

So here's what I don't understand. Why doesn't the "t#" argument specifier support read-write buffers as well as read-only buffers? Aren't read-write buffers a superset of read-only buffers?? Is there something I'm doing wrong or a quick fix to get this to work appropriately?

So... I've answered my own question on this. I had a look in getargs.c, and apparently the "t#" argument specifier only accepts character-based readable buffers.

Is there any chance anyone of adding an argument specifier for readable buffers in general? Say, "r#"?

Can anyone explain to me the rationale for having some data type support the readable buffer interface, but /NOT/ the character-based buffer interface? I can't find any information that explains the fundamental distinction between the two... and I don't see why array('B') shouldn't support both.

Dan



More information about the Python-Dev mailing list