]> granicus.if.org Git - python/commitdiff
Fix an apparent typo. This test of the readonly boolean should have been != 0
authorGregory P. Smith <greg@mad-scientist.com>
Sat, 15 Mar 2008 06:05:36 +0000 (06:05 +0000)
committerGregory P. Smith <greg@mad-scientist.com>
Sat, 15 Mar 2008 06:05:36 +0000 (06:05 +0000)
rather than >= 0.  This change means the PyBUF_LOCK flag to the buffer api
works on immutable bytes objects as one would expect.

Objects/abstract.c

index 655a52a0becedbeb490bfdf3e10d4fbd15648999..c0298a8aa39a19921339c5085ab7a5c6dae3a5e5 100644 (file)
@@ -673,7 +673,7 @@ PyBuffer_FillInfo(Py_buffer *view, void *buf, Py_ssize_t len,
 {
        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;