Message223583
| Author |
skrah |
| Recipients |
benjamin.peterson, dw, hynek, kmike, pitrou, scoder, serhiy.storchaka, skrah, stutzbach |
| Date |
2014年07月21日.16:04:47 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<20140721160446.GA27186@sleipnir.bytereef.org> |
| In-reply-to |
<1405956707.48.0.345859980717.issue22003@psf.upfronthosting.co.za> |
| Content |
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. |
|