Gregory P. Smith wrote:
> bytes objects are by their definition immutable and read only. but when
> passing one to a buffer api that tries to use the PyBUF_LOCK flag it
> raises BufferError "Cannot lock this object." from PyBuffer_FillInfo in
> Objects/abstract.c as called by Objects/bytesobject.c's bytes_getbuffer
> method.
>
> I think the problem is a >= 0 where a != 0 was intended in
> PyBuffer_FillInfo:
>
> --- Objects/abstract.c (revision 61375)
> +++ Objects/abstract.c (working copy)
> @@ -673,7 +673,7 @@
> {
> if (view == NULL) return 0;
> if (((flags & PyBUF_LOCK) == PyBUF_LOCK) &&
> - readonly >= 0) {
> + readonly != 0) {
> PyErr_SetString(PyExc_BufferError,
> "Cannot lock this object.");
> return -1;
>
>
Good catch. This looks like a good fix.
-Travis O.
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com