Stefan Krah added the comment: I think checking for a readonly view is fine. The protocol is this:
1) Use the PyBUF_WRITABLE flag in the request. Then the provider must either have a writable buffer or else deny the request entirely. 2) Omit the PyBUF_WRITABLE flag in the request. Then the provider can return a writable or a readonly buffer, but must set the readonly flag correctly AND export the same type of buffer to ALL consumers. It is not possible to ask for a readonly buffer explicitly, but the readonly flag in the Py_Buffer struct should always be set correctly. It is hard to guess the original intention of the PEP-3118 authors, but in practice "readonly" means "immutable" here. IMO a buffer provider would be seriously broken if a readonly buffer is mutated in any way. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22003> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com