[Python-Dev] memoryview: "B", "c", "b" format specifiers

Antoine Pitrou solipsis at pitrou.net
Thu Aug 18 22:53:06 CEST 2011


On Thu, 18 Aug 2011 18:57:00 +0200
Stefan Krah <stefan at bytereef.org> wrote:
> 
> Oh no, the name isn't quite right then. It should be a replacement
> for the combination PyBuffer_FillInfo()/PyMemoryView_FromBuffer()
> and it should temporarily wrap a C-string.

Ah, nice.

> PyObject * PyMemoryView_FromCString(char *s, Py_ssize_t size, int flags);

It's not really a C string, since it's not null-terminated.
PyMemoryView_FromMemory?

(that would mirror PyUnicode_FromUnicode, for example)

> 'flags' is just PyBUF_READ or PyBUF_WRITE.

Why do we have these in addition to PyBUF_WRITABLE already?

Regards

Antoine.




More information about the Python-Dev mailing list