[issue22003] BytesIO copy-on-write

Antoine Pitrou report at bugs.python.org
Tue Jul 22 20:50:01 CEST 2014


Antoine Pitrou added the comment:

There's also the following code in numpy's getbuffer method:

    /*
     * If a read-only buffer is requested on a read-write array, we return a
     * read-write buffer, which is dubious behavior. But that's why this call
     * is guarded by PyArray_ISWRITEABLE rather than (flags &
     * PyBUF_WRITEABLE).
     */
    if (PyArray_ISWRITEABLE(self)) {
        if (array_might_be_written(self) < 0) {
            goto fail;
        }
    }

... which seems to imply that mmap is not the only one with "dubious behaviour" (?).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22003>
_______________________________________


More information about the Python-bugs-list mailing list